[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ada8x9epuip.fsf@cisco.com>
Date: Tue, 17 Jul 2007 14:53:02 -0700
From: Roland Dreier <rdreier@...co.com>
To: Jeff Garzik <jgarzik@...hat.com>
Cc: akpm@...ux-foundation.org, torvalds@...ux-foundation.org,
linux-kernel@...r.kernel.org, linux-ide@...r.kernel.org,
chas@....nrl.navy.mil, rolandd@...co.com, dwmw2@...radead.org,
gregkh@...e.de
Subject: Re: [git patches 1/2] warnings: attack valid cases spotted by warnings
> drivers/infiniband/hw/mthca/mthca_qp: kill uninit'd var warning
>
> drivers/infiniband/hw/mthca/mthca_qp.c: In function
> âmthca_tavor_post_sendâ:
> drivers/infiniband/hw/mthca/mthca_qp.c:1594: warning: âf0â may be used
> uninitialized in this function
> drivers/infiniband/hw/mthca/mthca_qp.c: In function
> âmthca_arbel_post_sendâ:
> drivers/infiniband/hw/mthca/mthca_qp.c:1949: warning: âf0â may be used
> uninitialized in this function
>
> Initializing 'f0' is not strictly necessary in either case, AFAICS.
>
> I was considering use of uninitialized_var(), but looking at the
> complex flow of control in each function, I feel it is wiser and
> safer to simply zero the var and be certain of ourselves.
>
> Signed-off-by: Jeff Garzik <jeff@...zik.org>
I don't really like this. These functions are in the hottest, most
latency-sensitive code path of this driver, which is used by people
who care about nanoseconds. I'm quite confident that the code is
correct as written, and it really feels wrong to me to add bloat to
the fastpath just to cover up a shortcoming of gcc.
And I don't like using uninitialized_var() here for a similar
reason... the functions are complex and I would prefer to avoid hiding
future bugs that may creep in. In fact adding the initialization to 0
has a similar effect, since it shuts up the compiler even if the logic
in the function gets screwed up.
On the other hand I definitely sympathize with the desire to have a
warning-free build so that real warnings are more visible. I guess I
could live with the uninitialized_var() patch, although I would feel a
little sad.
- R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists