: niu: fix uninitialized variable warning
Subsystems (2)
PATCH 1/1 : niu: fix uninitialized variable warning
Fixes warning:
drivers/net/niu.c: In function ‘niu_process_rx_pkt’:drivers/net/niu.c:3457: error: ‘link’ may be used uninitialized in this function
drivers/net/niu.c +1 -1
@@ -3454,7 +3454,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np, num_rcr =0 ;while (1 ) { -struct page *page, **link; +struct page *page, **uninitialized_var (link );u32 rcr_size, append_size;u64 addr, val, off;
David Miller
maintainerFrom: Prarit Bhargava <[email protected]>
Date: Thu, 27 May 2010 14:35:03 -0400
Quoted 6 lines
Fixes warning:
drivers/net/niu.c: In function ‘niu_process_rx_pkt’:drivers/net/niu.c:3457: error: ‘link’ may be used uninitialized in this functionSigned-off-by Prarit Bhargava <[email protected]>
These blind uninitialized_var() annotations are almost always the wrong thing to do. And that is the case here.
The code that looks up the page here can return NULL if there is some error and the page hashes aren't setup properly, and then the callers go and blindly assume that 'page' is non-NULL without any error checking.
Applying this patch does more harm than good because it hides this issue. So I'm definitely not applying this patch.