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]
Date:	Fri, 17 Jun 2011 09:45:21 +1000
From:	Julian Calaby <julian.calaby@...il.com>
To:	Henry Ptasinski <henryp@...adcom.com>
Cc:	Greg Dietsche <gregory.dietsche@....edu>,
	"gregkh@...e.de" <gregkh@...e.de>,
	Brett Rudley <brudley@...adcom.com>,
	Dowan Kim <dowan@...adcom.com>,
	Roland Vossen <rvossen@...adcom.com>,
	Arend Van Spriel <arend@...adcom.com>,
	"linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: brcm80211: return false if not a broadcom board

Henry,

On Fri, Jun 17, 2011 at 09:37, Henry Ptasinski <henryp@...adcom.com> wrote:
> How's this for a somewhat clearer implementation:
>
> static bool brcms_c_validboardtype(struct brcms_c_hw_info *wlc_hw)
> {
>        bool goodboard = true;
>        uint boardrev = wlc_hw->boardrev;
>
>        if (wlc_hw->sih->boardvendor == PCI_VENDOR_ID_BROADCOM) {

You could reduce indentation by having this be:

if (wlc_hw->sih->boardvendor != PCI_VENDOR_ID_BROADCOM)
    return true;

>                /* validate boardrev */
>                if (boardrev == 0)
>                        goodboard = false;

and remove the goodboard variable by having this return false immediately.

>                else if (boardrev > 0xff) {

You could also drop the else and have this as

if (boardrev <= 0xff)
    return true;

>                        /* 4 bits each for board type, major, minor, and tiny
>                        version numbers */
>                        uint brt = (boardrev & 0xf000) >> 12;
>                        uint b0 = (boardrev & 0xf00) >> 8;
>                        uint b1 = (boardrev & 0xf0) >> 4;
>                        uint b2 = boardrev & 0xf;
>
>                        if ((brt > 2) || (brt == 0) || (b0 > 9) || (b0 == 0)
>                                || (b1 > 9) || (b2 > 9))
>                                goodboard = false;

and return false here too.

>                }
>        }
>
>        return goodboard;

then just return true here.

> }

Thanks,

-- 
Julian Calaby

Email: julian.calaby@...il.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
--
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