public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][2.4.30-pre2] fix undefined behaviour in cistpl.c
@ 2005-03-05 15:17 Mikael Pettersson
  2005-03-06 20:51 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Pettersson @ 2005-03-05 15:17 UTC (permalink / raw)
  To: dahinds; +Cc: linux-kernel, marcelo.tosatti

Compiling drivers/pcmcia/cistpl.c with gcc-4.0 generates this warning:

cistpl.c: In function 'read_cis_mem':
cistpl.c:143: warning: 'sys' is used uninitialized in this function

Note 'is' not 'may be'. And there is indeed a control flow path in
which 'sys' is updated with '+=' even though it has no initial value.
Luckily 'sys' is reassigned later before being used, making this
assignment redundant, so the fix is to simply remove it.

This problem is not present in the 2.6 kernel.

Signed-off-by: Mikael Pettersson <mikpe@csd.uu.se>

--- linux-2.4.30-pre2/drivers/pcmcia/cistpl.c.~1~	2004-02-18 15:16:23.000000000 +0100
+++ linux-2.4.30-pre2/drivers/pcmcia/cistpl.c	2005-03-05 15:51:37.000000000 +0100
@@ -140,7 +140,6 @@ int read_cis_mem(socket_info_t *s, int a
     } else {
 	u_int inc = 1;
 	if (attr) { mem->flags |= MAP_ATTRIB; inc++; addr *= 2; }
-	sys += (addr & (s->cap.map_size-1));
 	mem->card_start = addr & ~(s->cap.map_size-1);
 	while (len) {
 	    set_cis_map(s, mem);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-07 21:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-05 15:17 [PATCH][2.4.30-pre2] fix undefined behaviour in cistpl.c Mikael Pettersson
2005-03-06 20:51 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox