public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Umanets <torque@ukrpost.net>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.6.6 memory allocation checks in drivers/media/video/v4l1-compat.c
Date: Sun, 06 Jun 2004 19:25:51 +0300	[thread overview]
Message-ID: <1086539151.2793.98.camel@firefly> (raw)

Various memory allocation checks in drivers/media/video/v4l1-compat.c

 ./linux-2.6.6-modified/drivers/media/video/v4l1-compat.c |   17
+++++++++++++++
 1 files changed, 17 insertions(+)

Signed-off-by: Yury Umanets <torque@ukrpost.net>

diff -rupN ./linux-2.6.6/drivers/media/video/v4l1-compat.c
./linux-2.6.6-modified/drivers/media/video/v4l1-compat.c
--- ./linux-2.6.6/drivers/media/video/v4l1-compat.c	Mon May 10 05:32:38
2004
+++ ./linux-2.6.6-modified/drivers/media/video/v4l1-compat.c	Wed Jun  2
14:27:21 2004
@@ -308,6 +308,9 @@ v4l_compat_translate_ioctl(struct inode 
 		struct video_capability *cap = arg;
 
 		cap2 = kmalloc(sizeof(*cap2),GFP_KERNEL);
+		if (!cap2)
+			return -ENOMEM;
+                        
 		memset(cap, 0, sizeof(*cap));
 		memset(cap2, 0, sizeof(*cap2));
 		memset(&fbuf2, 0, sizeof(fbuf2));
@@ -425,6 +428,8 @@ v4l_compat_translate_ioctl(struct inode 
 		struct video_window	*win = arg;
 
 		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		if (!fmt2)
+			return -ENOMEM;
 		memset(win,0,sizeof(*win));
 		memset(fmt2,0,sizeof(*fmt2));
 
@@ -464,6 +469,8 @@ v4l_compat_translate_ioctl(struct inode 
 		int err1,err2;
 
 		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		if (!fmt2)
+			return -ENOMEM;
 		memset(fmt2,0,sizeof(*fmt2));
 		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 		drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type);
@@ -598,6 +605,8 @@ v4l_compat_translate_ioctl(struct inode 
 						  V4L2_CID_WHITENESS, drv);
 
 		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		if (!fmt2)
+			return -ENOMEM;
 		memset(fmt2,0,sizeof(*fmt2));
 		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -628,6 +637,8 @@ v4l_compat_translate_ioctl(struct inode 
 				V4L2_CID_WHITENESS, pict->whiteness, drv);
 
 		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		if (!fmt2)
+			return -ENOMEM;
 		memset(fmt2,0,sizeof(*fmt2));
 		fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 		err = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -861,6 +872,8 @@ v4l_compat_translate_ioctl(struct inode 
 		struct video_mmap	*mm = arg;
 
 		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		if (!fmt2)
+			return -ENOMEM;
 		memset(&buf2,0,sizeof(buf2));
 		memset(fmt2,0,sizeof(*fmt2));
 		
@@ -957,6 +970,8 @@ v4l_compat_translate_ioctl(struct inode 
 		struct vbi_format      *fmt = arg;
 		
 		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		if (!fmt2)
+			return -ENOMEM;
 		memset(fmt2, 0, sizeof(*fmt2));
 		fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
 		
@@ -981,6 +996,8 @@ v4l_compat_translate_ioctl(struct inode 
 		struct vbi_format      *fmt = arg;
 		
 		fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+		if (!fmt2)
+			return -ENOMEM;
 		memset(fmt2, 0, sizeof(*fmt2));
 
 		fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;

-- 
umka


                 reply	other threads:[~2004-06-06 16:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1086539151.2793.98.camel@firefly \
    --to=torque@ukrpost.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox