From: Kevin <kevin@pheared.net>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: Cotte@de.ibm.com, <linux-kernel@vger.kernel.org>, <Linux390@de.ibm.com>
Subject: Re: if (a & X || b & ~Y) in dasd.c
Date: Thu, 8 Nov 2001 16:10:51 -0500 (EST) [thread overview]
Message-ID: <Pine.GSO.4.40.0111081607110.8007-100000@eclipse.pheared.net> (raw)
In-Reply-To: <20011108155749.A24023@devserv.devel.redhat.com>
On Thu, 8 Nov 2001, Pete Zaitcev wrote:
[zaitce] Date: Thu, 8 Nov 2001 15:57:49 -0500
[zaitce] From: Pete Zaitcev <zaitcev@redhat.com>
[zaitce] To: Cotte@de.ibm.com
[zaitce] Cc: linux-kernel@vger.kernel.org, Linux390@de.ibm.com
[zaitce] Subject: if (a & X || b & ~Y) in dasd.c
[zaitce]
[zaitce] Carsten and others:
[zaitce]
[zaitce] this code in 2.2.14 looks suspicious to me:
[zaitce]
[zaitce] ./drivers/s390/block/dasd.c:
[zaitce] /* first of all lets try to find out the appropriate era_action */
[zaitce] if (stat->flag & DEVSTAT_FLAG_SENSE_AVAIL ||
[zaitce] stat->dstat & ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) {
[zaitce] /* anything abnormal ? */
[zaitce] if (device->discipline->examine_error == NULL ||
[zaitce] stat->flag & DEVSTAT_HALT_FUNCTION) {
[zaitce] era = dasd_era_fatal;
[zaitce] } else {
[zaitce] era = device->discipline->examine_error (cqr, stat);
[zaitce] }
[zaitce] DASD_DRIVER_DEBUG_EVENT (1, dasd_int_handler," era_code %d",
[zaitce] era);
[zaitce] }
[zaitce]
[zaitce] Are you sure any parenthesises are not needed here?
I'm not going to pretend to know what the code is accomplishing, but as
a matter of C, those &'s aren't the same as &&'s and will get executed as
the || is tested. So the first one will get &'ded and if false then the
second will and if neither return true then we move on.
Or, perhaps I'm being an idiot and misunderstanding the question and the
code. In that case, I'll pretend I didn't say anything. :)
-[ kevin@pheared.net devel.pheared.net ]-
-[ Rather be forgotten, than remembered for giving in. ]-
-[ ZZ = g ^ (xb * xa) mod p g = h^{(p-1)/q} mod p ]-
next prev parent reply other threads:[~2001-11-08 21:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-08 20:57 Pete Zaitcev
2001-11-08 21:10 ` Kevin [this message]
2001-11-08 21:18 ` Jonathan Lundell
2001-11-08 21:28 ` Richard B. Johnson
2001-11-19 18:40 ` bill davidsen
2001-11-19 19:38 ` Peter T. Breuer
2001-11-21 6:57 ` Stevie O
2001-11-09 10:29 Carsten Otte
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=Pine.GSO.4.40.0111081607110.8007-100000@eclipse.pheared.net \
--to=kevin@pheared.net \
--cc=Cotte@de.ibm.com \
--cc=Linux390@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zaitcev@redhat.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®