mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gérard Roudier" <groudier@free.fr>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: richard offer <offer@sgi.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: unitialized variable in 2.4.7 (sym53c8xx, dmi_scan)
Date: Thu, 26 Jul 2001 21:49:04 +0200 (CEST)	[thread overview]
Message-ID: <20010726213543.W1488-100000@gerard> (raw)
In-Reply-To: <E15PW9s-0002hY-00@the-village.bc.nu>



On Wed, 25 Jul 2001, Alan Cox wrote:

> >  static __init int disable_ide_dma(struct dmi_blacklist *d)
> >  {
> >  #ifdef CONFIG_BLK_DEV_IDE
> > @@ -169,6 +170,7 @@
> >  #endif
> >         return 0;
> >  }
> > +#endif
>
> This just makes it harder to finish the merges
>
> > makes that automatic.
> > ===== drivers/scsi/sym53c8xx.c 1.6 vs edited =====
> > --- 1.6/drivers/scsi/sym53c8xx.c        Thu Jul  5 04:28:16 2001
> > +++ edited/drivers/scsi/sym53c8xx.c     Wed Jul 25 13:37:10 2001
> > @@ -6991,7 +6991,7 @@
> >
> >  static void ncr_soft_reset(ncb_p np)
> >  {
> > -       u_char istat;
> > +       u_char istat=0;
> >         int i;
> >
> >         if (!(np->features & FE_ISTAT1) || !(INB (nc_istat1) & SRUN))
>
> And this means when we get a real bug with istat not being assigned it
> wont be seen.

This will not happen (istat will never be used unitialised).
The compiler has enough information to know about this at compile time as
the full code below demonstrates clearly:

--

static void ncr_soft_reset(ncb_p np)
{
	u_char istat;
	int i;

	if (!(np->features & FE_ISTAT1) || !(INB (nc_istat1) & SRUN))
		goto do_chip_reset;

	OUTB (nc_istat, CABRT);
	for (i = 100000 ; i ; --i) {
		istat = INB (nc_istat);
		if (istat & SIP) {
			INW (nc_sist);
		}
		else if (istat & DIP) {
			if (INB (nc_dstat) & ABRT);
				break;
		}
		UDELAY(5);
	}
	OUTB (nc_istat, 0);
	if (!i)
		printk("%s: unable to abort current chip operation, "
		       "ISTAT=0x%02x.\n", ncr_name(np), istat);
do_chip_reset:
	ncr_chip_reset(np);
}

--

IMO, the problem should be reported to the compiler maintainers. By
assigning some fake definitions to FE_ISTAT1, SRUN, INB(), etc...,
the code above should help them fix the compiler paranoia disease.
Changing the driver code looks like an odd idea.

  Gérard.


      parent reply	other threads:[~2001-07-26 19:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-25 20:43 richard offer
2001-07-25 21:25 ` Alan Cox
2001-07-25 21:58   ` richard offer
2001-07-26 19:49   ` Gérard Roudier [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=20010726213543.W1488-100000@gerard \
    --to=groudier@free.fr \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=offer@sgi.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®