* [PATCH]: niu: fix uninitialized variable warning
@ 2010-05-27 18:35 Prarit Bhargava
2010-05-27 23:23 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Prarit Bhargava @ 2010-05-27 18:35 UTC (permalink / raw)
To: netdev; +Cc: Prarit Bhargava
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
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 30abb4e..3ace57b 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH]: niu: fix uninitialized variable warning
2010-05-27 18:35 [PATCH]: niu: fix uninitialized variable warning Prarit Bhargava
@ 2010-05-27 23:23 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-05-27 23:23 UTC (permalink / raw)
To: prarit; +Cc: netdev
From: Prarit Bhargava <prarit@redhat.com>
Date: Thu, 27 May 2010 14:35:03 -0400
> 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
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-27 23:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 18:35 [PATCH]: niu: fix uninitialized variable warning Prarit Bhargava
2010-05-27 23:23 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).