]> git.baikalelectronics.ru Git - kernel.git/commit
net: stmmac: sti: Fix uninitialized pointer dereference if !OF
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 15 Dec 2014 11:25:51 +0000 (12:25 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Dec 2014 16:48:02 +0000 (11:48 -0500)
commit9980d4c4b965c5e94f7d187f61b0bbbce1a0794c
treedd85f8e867c66d720a9e2172878b0a550e3b34ea
parentadefa3bdbcc735ffc46cc801948810c06999561b
net: stmmac: sti: Fix uninitialized pointer dereference if !OF

If CONFIG_OF is not set:

drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c: In function ‘sti_dwmac_parse_data’:
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c:318: warning: ‘rs’ is used uninitialized in this function

of_property_read_string() will return -ENOSYS in this case, and rs will
be an uninitialized pointer.

While the fallback clock selection is already selected correctly in this
case, the string comparisons should be skipped too, else the system will
crash while dereferencing the uninitialized pointer.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c