]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net: bnx2x: fix improper return value
authorPan Bian <bianpan2016@163.com>
Sun, 4 Dec 2016 10:46:03 +0000 (18:46 +0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 27 Feb 2017 02:03:30 +0000 (18:03 -0800)
commit49613abd60f4fd77185d0dc8b2979ed2db31fb75
treebc0b11fe075622161831879b1c960ffec562bd17
parent8e33829cbf71b07d990dab82573d486028dc2cda
net: bnx2x: fix improper return value

Orabug: 25477835

Macro 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@163.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 005f7e68e74df94c2a676b5a3e98c6fb65aae606)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c