Search Linux Wireless

Re: [PATCH 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 23, 2015 at 08:19:18PM +0900, Chaehyun Lim wrote:
> Add error check if memory allocation is failed.
> 
> Signed-off-by: Chaehyun Lim <chaehyun.lim@xxxxxxxxx>
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
> index 7e2b2ab41..b51c15f 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
>  		u32 u32Tsf_Hi;
>  
>  		pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_ATOMIC);
> +		if (pstrNetworkInfo == NULL)
> +			return -ENOMEM;

Run your patches through checkpatch.pl --strict.  These days we prefer:

		if (!pstrNetworkInfo)
			return -ENOMEM;

These patches are nice otherwise.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux