This patch fix possible NULL pointer dereference if kzalloc
failed. To be able to return proper error code the function
return type is changed to ssize_t (according to callees and
sysfs definitions).
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Index: linux-2.6.git/mm/slub.c
===================================================================
--- linux-2.6.git.orig/mm/slub.c 2008-03-02 22:53:27.000000000 +0300
+++ linux-2.6.git/mm/slub.c 2008-03-02 23:02:27.000000000 +0300
@@ -3591,8 +3591,8 @@ enum slab_stat_type {
#define SO_CPU (1 << SL_CPU)
#define SO_OBJECTS (1 << SL_OBJECTS)
-static unsigned long slab_objects(struct kmem_cache *s,
- char *buf, unsigned long flags)
+static ssize_t slab_objects(struct kmem_cache *s,
+ char *buf, unsigned long flags)
{
unsigned long total = 0;
int cpu;
@@ -3602,6 +3602,8 @@ static unsigned long slab_objects(struct
unsigned long *per_cpu;
nodes = kzalloc(2 * sizeof(unsigned long) * nr_node_ids, GFP_KERNEL);
+ if (!nodes)
+ return -ENOMEM;
per_cpu = nodes + nr_node_ids;
for_each_possible_cpu(cpu) {
--
| Eric Paris | TALPA - a threat model? well sorta. |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Rafael J. Wysocki | [Bug #10741] bug in `tty: BKL pushdown'? |
git: | |
| David Brown | Re: Something is broken in repack |
| H. Peter Anvin | Re: First cut at git port to Cygwin |
| Kevin Leung | Edit log message after commit |
| Johannes Schindelin | Re: Official Git Homepage change? Re: git-scm.com |
| Richard Stallman | Real men don't attack straw men |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Daniel Ouellet | identifying sparse files and get ride of them trick available? |
| Michael | Re: running mail server at home |
| Gerrit Renker | [PATCH 13/37] dccp: Deprecate Ack Ratio sysctl |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jussi Kivilinna | [PATCH 02/14] [cdc_ether] Hardwire CDC descriptors when missing |
| Denis V. Lunev | [PATCH 12/17 net-2.6.26] [NETNS]: Process /proc/net/rt_cache inside a namespace. |
