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] [day] [month] [year] [list]
Message-ID: <20120927125314.GD14358@n2100.arm.linux.org.uk>
Date:	Thu, 27 Sep 2012 13:53:14 +0100
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Linus Walleij <linus.walleij@...ricsson.com>
Cc:	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	Anmar Oueja <anmar.oueja@...aro.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	Stephen Warren <swarren@...dia.com>,
	Rob Herring <rob.herring@...xeda.com>
Subject: Re: [PATCH] pinctrl/nomadik: allocate IRQ descriptors dynamically

On Wed, Sep 26, 2012 at 07:18:07PM +0200, Linus Walleij wrote:
> +	irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio);
> +	irq_base = irq_alloc_descs(irq_start, 0, NMK_GPIO_PER_CHIP,
> +				   numa_node_id());
> +	if (IS_ERR_VALUE(irq_base)) {

commit 07ab67c8d0d7c1021343b7d5c045033d6bf7be69
Author: Linus Torvalds <torvalds@...970.osdl.org>
Date:   Thu May 19 22:43:37 2005 -0700

    Fix get_unmapped_area sanity tests

    As noted by Chris Wright, we need to do the full range of tests regardless
    of whether MAP_FIXED is set or not, so re-organize get_unmapped_area()
    slightly to do the sanity checks unconditionally.

diff --git a/include/linux/err.h b/include/linux/err.h
index 17c55df..ff71d2a 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -13,6 +13,8 @@
  * This should be a per-architecture thing, to allow different
  * error and pointer decisions.
  */
+#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)

This is because get_unmapped_area() can return negative numbers which are
not error codes.

My position on this is that IS_ERR_VALUE() should only be used for checking
the return value of a function where some negative numbers are not error
codes, and everywhere else should use "ret < 0".

Just because we have a funky macro is no reason to blindly (ab)use it.
--
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