[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20161205.145926.1120588530863327322.davem@davemloft.net>
Date: Mon, 05 Dec 2016 14:59:26 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: bianpan201604@....com
Cc: Yuval.Mintz@...ium.com, ariel.elior@...ium.com,
everest-linux-l2@...ium.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, bianpan2016@....com
Subject: Re: [PATCH 1/1] net: ethernet: broadcom: fix improper return value
From: Pan Bian <bianpan201604@....com>
Date: Sun, 4 Dec 2016 14:29:29 +0800
> From: Pan Bian <bianpan2016@....com>
>
> Marco BNX2X_ALLOC_AND_SET(arr, lbl, func) calls kmalloc() to allocate
> memory, and jumps to label "lbl" if the allocation fails. Label "lbl"
> first cleans memory and then returns variable rc. Before calling the
> macro, the value of variable rc is 0. Because 0 means no error, the
> callers of bnx2x_init_firmware() may be misled. This patch fixes the bug,
> assigning "-ENOMEM" to rc before calling macro NX2X_ALLOC_AND_SET().
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189141
>
> Signed-off-by: Pan Bian <bianpan2016@....com>
Applied, but...
> @@ -13505,6 +13505,7 @@ static int bnx2x_init_firmware(struct bnx2x *bp)
>
> /* Initialize the pointers to the init arrays */
> /* Blob */
> + rc = -ENOMEM;
> BNX2X_ALLOC_AND_SET(init_data, request_firmware_exit, be32_to_cpu_n);
>
> /* Opcodes */
These kinds of macros which internally change control flow should always
be avoided.
Powered by blists - more mailing lists