All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: dahinds@users.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][2.4.30-pre2] fix undefined behaviour in cistpl.c
Date: Sun, 6 Mar 2005 17:51:14 -0300	[thread overview]
Message-ID: <20050306205114.GA2543@logos.cnet> (raw)
In-Reply-To: <200503051517.j25FHI2U001419@harpo.it.uu.se>

On Sat, Mar 05, 2005 at 04:17:18PM +0100, Mikael Pettersson wrote:
> 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.

Indeed - applied, thanks Mikael.

> 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);

      reply	other threads:[~2005-03-07 21:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050306205114.GA2543@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=dahinds@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.