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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 31 Jan 2012 13:08:52 -0700
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Jack Stone <jwjstone@...tmail.fm>
Cc:	Ohad Ben-Cohen <ohad@...ery.com>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, Mark Grosen <mgrosen@...com>
Subject: Re: [PATCH 2/2] remoteproc: s/big switch/lookup table/

On Tue, Jan 31, 2012 at 05:58:10PM +0000, Jack Stone wrote:
> On 31/01/12 16:52, Ohad Ben-Cohen wrote:
> > +/*
> > + * A lookup table for resource handlers. Always keep in sync with
> > + * enum fw_resource_type.
> > + */
> > +static rproc_handle_resource_t rproc_handle_rsc[] = {
> > +	rproc_handle_carveout,	/* RSC_CARVEOUT */
> > +	rproc_handle_devmem,	/* RSC_DEVMEM */
> > +	rproc_handle_trace,	/* RSC_TRACE */
> > +	rproc_handle_vring,	/* RSC_VRING */
> > +	NULL, /* RSC_VIRTIO_DEV is handled early upon registration */
> > +};
> > +
> 
> You could change this to
> 
> [RSC_CARVEOUT] = rproc_handle_carveout,
> 
> Then you would be safe against renumbering and would only need to worry
> about addition (which your RSC_LAST check copes with).

Yes, that is the right thing to do.  Then the compiler can catch ordering
issues for you.

g.

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