lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 15 Feb 2009 21:51:41 +0100
From:	Sam Ravnborg <sam@...nborg.org>
To:	petkovbb@...il.com, bzolnier@...il.com, linux-ide@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/10] ide: add flags query macros

On Sun, Feb 15, 2009 at 07:01:41PM +0100, Borislav Petkov wrote:
> Hi,
> 
> > > Signed-off-by: Borislav Petkov <petkovbb@...il.com>
> > > ---
> > >  include/linux/ide.h |  166 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  1 files changed, 166 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/include/linux/ide.h b/include/linux/ide.h
> > > index c75631c..f133062 100644
> > > --- a/include/linux/ide.h
> > > +++ b/include/linux/ide.h
> > > @@ -497,6 +497,82 @@ enum {
> > >  	IDE_AFLAG_NO_AUTOCLOSE		= (1 << 24),
> > >  };
> > >  
> > > +#define ide_drv_drq_int(drive) \
> > > +	((drive)->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT)
> > 
> > Why not use a static inline here so we get proper typecheck.
> > And then convert the return result to a bool (0/1) so you
> > do not have to do this at the call site.
> > 
> > I counted at least three places in ide-cd that does a local
> > transformation to a bool and I saw nowhere the actual bit value
> > was used.
> 
> I'm assuming you're talking about those places (and similar):
> 
> drive->dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);

And in other places we do:

ide_drv_drq_int(drive) ? 1 : 0

> Well, actually we almost never use the 0/1 bool value and this one
> case is more of an exception. If you take a closer look, we don't have
> setters/getters ...,
I scanned all your patches and I did not find a single place where
the macros was not used as a bool value.
Mostly in if (ide_drv_drq_int(drive)) .. and ide_drv_drq_int(drive) &&
statements.

> So the macros as such are
> simply to save some stack and improve readability and since the whole
> thing keeps changing we might just as well turn them into static inlines
> one fine day :).
gcc will optmize the static inline functions so there is no drawbacks only
better type checking.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ