lkml.org 
[lkml]   [2007]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] drivers/media/video/videocodec.c: check kmalloc() return value.
From
On 067, 03 08, 2007 at 11:14:01PM -0800, Amit Choudhary wrote:
> Description: Check the return value of kmalloc() in function videocodec_build_table(), in file drivers/media/video/videocodec.c.
>
> Signed-off-by: Amit Choudhary <amit2030@gmail.com>
>
> diff --git a/drivers/media/video/videocodec.c b/drivers/media/video/videocodec.c
> index 2ae3fb2..16fc1dd 100644
> --- a/drivers/media/video/videocodec.c
> +++ b/drivers/media/video/videocodec.c
> @@ -348,6 +348,8 @@ #define LINESIZE 100
> kfree(videocodec_buf);
> videocodec_buf = (char *) kmalloc(size, GFP_KERNEL);
>
> + if (!videocodec_buf)
> + return 0;
> i = 0;
> i += scnprintf(videocodec_buf + i, size - 1,
> "<S>lave or attached <M>aster name type flags magic ");

Can you also remove useless (char *) cast above ?

--
Andrey Panin | Linux and UNIX system administrator
pazke@donpac.ru | PGP key: wwwkeys.pgp.net
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2007-03-09 10:07    [W:0.053 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site