[PATCH] fix undefined behaviour in cistpl.c
Linux Kernel Mailing List <[email protected]> Sun, 06 Mar 2005 20:51:52 +0000
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
ChangeSet 1.1566, 2005/03/06 17:51:52-03:00, [email protected] [PATCH] fix undefined behaviour in cistpl.c 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 <[email protected]> cistpl.c | 1 - 1 files changed, 1 deletion(-) diff -Nru a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c --- a/drivers/pcmcia/cistpl.c 2005-03-10 08:04:22 -08:00 +++ b/drivers/pcmcia/cistpl.c 2005-03-10 08:04:22 -08:00 @@ -140,7 +140,6 @@ } 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);