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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110125111701.GF11507@n2100.arm.linux.org.uk>
Date:	Tue, 25 Jan 2011 11:17:01 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	walter harms <wharms@....de>
Cc:	Julia Lawall <julia@...u.dk>, Vasiliy Kulikov <segooon@...il.com>,
	Ryan Mallon <ryan@...ewatersys.com>,
	kernel-janitors@...r.kernel.org,
	Nicolas Ferre <nicolas.ferre@...el.com>,
	Jean-Christophe PLAGNIOL-VILLARD <plagnioj@...osoft.com>,
	Andrew Victor <linux@...im.org.za>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] arch/arm/mach-at91/clock.c: Add missing IS_ERR test

On Tue, Jan 25, 2011 at 12:12:45PM +0100, walter harms wrote:
> Am 25.01.2011 11:43, schrieb Russell King - ARM Linux:
> > On Tue, Jan 25, 2011 at 11:33:16AM +0100, walter harms wrote:
> >> Would it be more easy to return NULL in the error case of clk_get() instead
> >> of ERR_PTR(-ENOENT) ?
> >>
> >> So the default could be return NULL and an architecture depending solution
> >> replacing that.
> > 
> > That's not how the API is defined.  The API defines error-pointers to be
> > errors, everything should be considered valid.  Please don't go down the
> > route of doing something architecturally different from that.
> > 
> > What if, say, you couldn't return the struct clk because maybe it could
> > only be controlled by one user?  Returning an EBUSY error pointer would
> > indicate this condition.  What if the module providing the struct clk
> > hasn't finished initializing - that's another reason for EBUSY rather
> > than ENOENT.
> > 
> > Error codes are useful to describe why something failed.  NULL pointers
> > can't do that.
> > 
> 
> On Mon, 24 Jan 2011, Vasiliy Kulikov wrote:
> > 
> ...
> > clk_get() is defined per-architecture, sometimes it is NULL only.
> >
> 
> So these is a bug ? They should return -ENOENT ?

You're stuck in "NULL is an error" mode.  struct clk * is a cookie which
only the clk API implementation understands.  It must not be treated as
anything different by drivers.  The only defined values for drivers are
error pointer codes which translate to errors.  Everything else, drivers
must assume is valid.  Drivers are not allowed to dereference struct clk.

It is for the clk API to interpret the struct clk * cookie as it sees fit.
--
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