lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Nov 2013 17:03:13 +0100
From:	Levente Kurusa <levex@...ux.com>
To:	Geyslan Gregório Bem <geyslan@...il.com>
CC:	Caizhiyong <caizhiyong@...ilicon.com>,
	Mark Brown <broonie@...nel.org>,
	Greg KH <gregkh@...uxfoundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	"Wanglin (Albert)" <albert.wanglin@...ilicon.com>,
	Levente Kurusa <levex@...ux.com>
Subject: Re: [PATCH] regmap: Fix 'ret' would return an uninitialized value

2013-11-15 16:52 keltezéssel, Geyslan Gregório Bem írta:
> 2013/11/15 Levente Kurusa <levex@...ux.com>:
>> 2013-11-15 14:00 keltezéssel, Geyslan Gregório Bem írta:
>>> 2013/11/15 Caizhiyong <caizhiyong@...ilicon.com>:
>>>> From: Cai Zhiyong <caizhiyong@...wei.com>
>>>> Date: Mon, 11 Nov 2013 19:26:14 +0800
>>>> Subject: [PATCH] regmap: Fix 'ret' would return an uninitialized value
>>>>
>>>> This patch give a warning when calling regmap_register_patch with
>>>> parameter num_regs <= 0.
>>>>
>>>> When the num_regs parameter is zero and krealloc doesn't fail,
>>>> then the code would return an uninitialized value. However,
>>>> calling this function with num_regs == 0, would be a waste as it
>>>> essentially does nothing.
>>>>
>>>> Signed-off-by: Cai Zhiyong <caizhiyong@...wei.com>
>>> Reviewed-by: Geyslan G. Bem <geyslan@...il.com>
>>>
>>> Seems a good approach.
>>>
>>
>> The patch doesn't apply. After manually applying this it
>> threw a compilation error:
>>
>> drivers/base/regmap/regmap.c: In function ‘regmap_register_patch’:
>> drivers/base/regmap/regmap.c:2176:6: error: expected expression before ‘)’ token
>>
>>
>> Cai,
>> You have missed the second parameter of WARN_ONCE().
>> Please append what you'd prefer to have outputten once the condition evaluates to true.
>>
>> --
>> Regards,
>> Levente Kurusa
> Cai, Levente,
> 
> Maybe this:
> 
> +       if (WARN_ONCE(num_regs <= 0, "number of registers [%d] must be
> major than 0", num_regs))
> +               return 0;
> +
> 

It is fine, but I think outputting num_regs is unnecessary.
Also, that line is more than 80 characters, so please wrap it.

-- 
Regards,
Levente Kurusa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ