Message ID | 20211028072306.1351-1-yajun.deng@linux.dev |
---|---|
State | Rejected, archived |
Delegated to: | Simon Wunderlich |
Headers | show |
Series | [net-next] batman-adv: Fix the wrong definition | expand |
October 28, 2021 3:35 PM, "Antonio Quartulli" <a@unstable.cc> 写到: > Hi, > > On 28/10/2021 09:23, Yajun Deng wrote: > >> There are three variables that are required at most, >> no need to define four variables. >> >> Fixes: 0fa4c30d710d ("batman-adv: Make sysfs support optional") >> Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > > NAK. > > kobject_uevent_env() does not know how many items are stored in the > array and thus requires it to be NULL terminated. > > Please check the following for reference: > > https://elixir.bootlin.com/linux/v5.15-rc6/source/lib/kobject_uevent.c#L548 > Oh, I didn't notice there. > OTOH I guess we could still use '{}' for the initialization. > > Regards, > > -- > Antonio Quartulli
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 3ddd66e4c29e..758035b3796d 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -656,7 +656,7 @@ int batadv_throw_uevent(struct batadv_priv *bat_priv, enum batadv_uev_type type, { int ret = -ENOMEM; struct kobject *bat_kobj; - char *uevent_env[4] = { NULL, NULL, NULL, NULL }; + char *uevent_env[3] = {}; bat_kobj = &bat_priv->soft_iface->dev.kobj;
There are three variables that are required at most, no need to define four variables. Fixes: 0fa4c30d710d ("batman-adv: Make sysfs support optional") Signed-off-by: Yajun Deng <yajun.deng@linux.dev> --- net/batman-adv/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)