Skip to contentSkip to conversation

Fix: Removed warning.

PATCH Kees Cook 1 participant 1 message Nov 9, 2017 1 message not in the archive Proc sysctl

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1510175310533.3725.5766@webmail3

Kees Cook

author
#1 lore raw
Quoted 25 lines · Ola Næss Kaldestad

Removed unnecessary else statement after return.

---
kernel/sysctl.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)
kernel/sysctl.c +3 -3
index d9c31bc2eaea..f5a3defff52d 100644
@@ -3093,10 +3093,10 @@ int proc_do_large_bitmap(struct ctl_table *table,
 int write,
 *lenp -= left;
 *ppos += *lenp;
 return 0;
- } else {
- kfree(tmp_bitmap);
- return err;
 }
+
+ kfree(tmp_bitmap);
+ return err;
 }
 
Quoted 2 lines

#else /* CONFIG_PROC_SYSCTL */

This patch appears to be white-space damaged. I think this could actually be improved further too, since the "if" case also does kfree(tmp_bitmap); and return err; (where err==0). Maybe just this, instead? (This patch will probably be whitespace damaged too, via gmail.)

kernel/sysctl.c +0 -0
index d9c31bc2eaea..87fbb3e966d5 100644
@@ -3089,14 +3089,12 @@ int proc_do_large_bitmap(struct ctl_table

*table, int write,

                        else
                                bitmap_copy(bitmap, tmp_bitmap, bitmap_len);
                }
-               kfree(tmp_bitmap);
                *lenp -= left;
                *ppos += *lenp;
-               return 0;
-       } else {
-               kfree(tmp_bitmap);
-               return err;
        }

+
+ kfree(tmp_bitmap);
+ return err;
}

#else /* CONFIG_PROC_SYSCTL */

Signature · 2 lines
Kees Cook
Pixel Security