Thread (6 messages) 6 messages, 5 authors, 2014-07-08

Re: [PATCH] batman-adv: Use kasprintf

From: Julia Lawall <hidden>
Date: 2014-06-28 20:14:09
Also in: batman, lkml

On Sat, 28 Jun 2014, Antonio Quartulli wrote:
Hi all,

On 28/06/14 21:13, Joe Perches wrote:
quoted
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c
index f40cb04..d6fba94 100644
--- a/net/batman-adv/sysfs.c
+++ b/net/batman-adv/sysfs.c
@@ -896,7 +896,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];

Joe, why are you shortening this? kobject_uevent_env() expect a
NULL-terminating array (that is the forth cell).

...
quoted
 
 	ret = kobject_uevent_env(bat_kobj, KOBJ_CHANGE, uevent_env);
And how is this change reducing the code space?

For what concerns the labels, we use this pattern mostly all over the
code: one single label/exit-point with the related NULL checks. Do you
think that we can improve something by changing this? (I am not talking
about the fastpath here).
Most of the kernel uses specific labels for each possible failure.
From my selfish point of view, it makes the code easier to analyze and 
understand, because what is done at the exit label is only what needs to 
be done.

julia
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help