Subject: Re: [PATCH net v5] bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set()

From: Jay Vosburgh <[email-masked]>
Date: Mon, 01 Jul 2024 16:07:46 -0700

Jakub Kicinski <[email-masked]> wrote:

>On Sun, 30 Jun 2024 14:20:55 +0100 'Simon Horman' wrote:
>> +		if (!(strlen(newval->string)) ||
>
>The extra brackets made me look, this really feels like it wants to be
>written as:
>
>	if (!newval->string[0] ||
>
>or:
>
>	if (strlen(newval->string) < 1 ||

	I find the second option clearer, FWIW.  This isn't in a hot
path, and including strlen() in there makes it more obvious to my
reading what the intent is.  The size_t return from strlen() is
unsigned, so we really want to test the return value for zero-ness.

	-J

---
	-Jay Vosburgh, [email-masked]