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: <20170613134607.GA5042@kroah.com>
Date:   Tue, 13 Jun 2017 15:46:07 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Tomas Winkler <tomas.winkler@...el.com>
Cc:     Alexander Usyskin <alexander.usyskin@...el.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [char-misc-next 3/3] mei: me: use an index instead of a pointer
 for private data

On Mon, Jun 12, 2017 at 12:15:57PM +0300, Tomas Winkler wrote:
> +static const struct mei_cfg *const mei_cfg_list[] = {
> +	NULL,
> +	&mei_me_legacy_cfg,
> +	&mei_me_ich_cfg,
> +	&mei_me_pch_cfg,
> +	&mei_me_pch_cpt_pbg_cfg,
> +	&mei_me_pch8_cfg,
> +	&mei_me_pch8_sps_cfg,
> +};

Does this structure have to keep in sync with:

> +enum mei_cfg_idx {
> +	MEI_ME_UNDEF_CFG,
> +	MEI_ME_LEGACY_CFG,
> +	MEI_ME_ICH_CFG,
> +	MEI_ME_PCH_CFG,
> +	MEI_ME_PCH_CPT_PBG_CFG,
> +	MEI_ME_PCH8_CFG,
> +	MEI_ME_PCH8_SPS_CFG,
> +	MEI_ME_NUM_CFG,
> +};

That value?

If so, why not make it automatic and have the array use the enum values?
That way you know you get it right.

At the very least, document the heck out of this...

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ