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:	Tue, 13 May 2014 18:38:44 -0400
From:	Valdis.Kletnieks@...edu
To:	"Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
Cc:	Heinrich Schuchardt <xypron.glpk@....de>,
	Eric Paris <eparis@...hat.com>, Jan Kara <jack@...e.cz>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1 v2] fanotify: check file flags passed in fanotify_init

On Tue, 13 May 2014 19:34:33 +0200, "Michael Kerrisk (man-pages)" said:

> >> The 'switch' could just be replaced by:
> >>
> >> if ((event_f_flags & O_ACCMODE) == 3)
> >>          return -EINVAL;
> >>
> >> (But I'm not sure if some might prefer the idiom you have used.)
> >>
> >> Cheers,
> >>
> >> Michael
> >
> > Using explicit numbers makes the code hard to read and analyze.
> > I do not intend to participate in the Obfuscated C Code Contest.
>
> I agree that using explicit numbers is odd, but '3" in this
> context does have a special meaning (see open(2)), and it struck
> me as a more efficient way of doing the check. But, if others
> are fine with what you've written, I have no real problem with it.

I'd be OK with the '== 3' version if there was a comment about the
reserved access mode like:

	/* reserved ioctl-only mode, so no fanotify for you */
	if ((event_f_flags & O_ACCMODE) == 3)
		return -EINVAL;

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ