[PATCH] libertas: add NULL check on return value of get_zeroed_page

John W. Linville linville at tuxdriver.com
Mon Aug 24 16:00:19 EDT 2009


On Sun, Aug 23, 2009 at 10:22:22PM +0530, Kiran Divekar wrote:
> From fb132b536facfbdc47a24afe538c50662d16b3ad Mon Sep 17 00:00:00 2001
> From: Kiran Divekar <kirandivekar at gmail.com>
> Date: Sun, 23 Aug 2009 22:05:21 +0530
> Subject: [PATCH] add NULL check on return value of get_zeroed_page
> 
> Most of the places in debugfs.c are missing a NULL check on the return value of
> get_zeroed_page API call. Added required NULL check at appropriate places.
> 
> Signed-off-by: Kiran Divekar <kirandivekar at gmail.com>

#1 -- Don't post the output of git format-patch directly like this.  Use git
	send-email instead.

> ---
>  drivers/net/wireless/libertas/debugfs.c |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/wireless/libertas/debugfs.c
> b/drivers/net/wireless/libertas/debugfs.c
> index 811ffc3..893a55c 100644
> --- a/drivers/net/wireless/libertas/debugfs.c
> +++ b/drivers/net/wireless/libertas/debugfs.c
> @@ -45,6 +45,8 @@ static ssize_t lbs_dev_info(struct file *file, char
> __user *userbuf,
>         unsigned long addr = get_zeroed_page(GFP_KERNEL);
>         char *buf = (char *)addr;
>         ssize_t res;
> +       if (!buf)
> +               return -ENOMEM;
> 
>         pos += snprintf(buf+pos, len-pos, "state = %s\n",
>                                 szStates[priv->connect_status]);

#2 -- Don't use an MUA that alters whitespace in the message.

Feel free to repost...

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.



More information about the libertas-dev mailing list