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] [day] [month] [year] [list]
Date:	Tue, 22 Jul 2008 03:24:38 -0700
From:	David Brownell <david-b@...bell.net>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	Eric Miao <eric.y.miao@...il.com>,
	Jean Delvare <khali@...ux-fr.org>,
	Jack Ren <jack.ren@...vell.com>
Subject: Re: [patch 2.6.26-rc-mm] gpio: max732x driver

On Tuesday 22 July 2008, Andrew Morton wrote:
> > +     if ((mask & chip->dir_input) == 0) {
> > +             dev_dbg(&chip->client->dev, "%s port %d is output only\n",
> > +                     chip->client->name, off);
> > +             return -EACCES;
> 
> I don't think that EACCES is a suitable error code here.  That's a
> security/permissions sort of thing.  If userspace is requesting this
> driver to do something which the hardware cannot do then probably
> EINVAL is the appropriate return code.

EINVAL is one of the most ambiguous return codes available.  It's
worth avoiding whenever there's *ANY* more meaningful code!  In this
case, the gpio_direction_input() call is good about returning that
fault code only for bogus GPIO numbers.

EACCES is what you should get trying to open a write-only file for
reading, which seems like a very direct analogy.  That argument is
just fine... it's the particular access request which must be denied,
in this case because hardware itself disallows it rather than a bit
in an inode.

- Dave
--
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