mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: bzolnier@gmail.com
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 5/6] ide: fix races in handling of user-space SET XFER commands
Date: Tue, 23 Jun 2009 16:40:42 -0700 (PDT)	[thread overview]
Message-ID: <20090623.164042.226354730.davem@davemloft.net> (raw)
In-Reply-To: <200906232335.51621.bzolnier@gmail.com>

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: Tue, 23 Jun 2009 23:35:51 +0200

I just noticed the following while re-reading this patch.

> @@ -322,10 +322,17 @@ static void ide_error_cmd(ide_drive_t *d
>  void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat)
>  {
>  	struct request *rq = drive->hwif->rq;
> -	u8 err = ide_read_error(drive);
> +	u8 err = ide_read_error(drive), nsect = cmd->tf.nsect;
> +	u8 set_xfer = !!(cmd->tf_flags & IDE_TFLAG_SET_XFER);
>  

There is no reason to use 'u8' for set_xfer.  It's a boolean
so use 'bool' and then you can eliminate that "!!()" double
negate.

The only reason you would need that double-negate is because
cmd->tf_flags is a u16 and IDE_TFLAG_SET_XFER is in fact one
of those upper 8-bits.

Further confirming that a bool would be a better choice here.

      reply	other threads:[~2009-06-23 23:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-23 21:35 Bartlomiej Zolnierkiewicz
2009-06-23 23:40 ` David Miller [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=20090623.164042.226354730.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome