Re: [PATCH v1 1/1] pinctrl: Move for_each_maps() to namespace and hide iterator inside

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 09, 2022 at 05:57:24PM +0200, Andy Shevchenko wrote:
> First of all, while for_each_maps() is private to pin control subsystem
> it's still better to have it put into a namespace.
> 
> Besides that, users are not relying on iterator variable, so hide it
> inside for-loop.

...

> +#define for_each_pin_map(_maps_node_, _map_)						\
> +	list_for_each_entry(_maps_node_, &pinctrl_maps, node)				\
> +		for (unsigned int __i = 0;						\

> +		     _map_ = &_maps_node_->maps[__i], __i < _maps_node_->num_maps;	\

Hmm... I think this is actually not okay, if we have maps be NULL and
num_maps = 0, KABOOM is guaranteed.

I will experiment and update this.

Meanwhile, Linus, do you think this change is useful?

> +		     __i++)

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux