2014-07-25 18:30:58

by Andrey Utkin

[permalink] [raw]
Subject: [PATCH] drivers/media/pci/solo6x10/solo6x10-disp.c: check kzalloc() result

Signed-off-by: Andrey Utkin <[email protected]>
---
drivers/media/pci/solo6x10/solo6x10-disp.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/media/pci/solo6x10/solo6x10-disp.c b/drivers/media/pci/solo6x10/solo6x10-disp.c
index ed88ab4..93cbbb1 100644
--- a/drivers/media/pci/solo6x10/solo6x10-disp.c
+++ b/drivers/media/pci/solo6x10/solo6x10-disp.c
@@ -216,6 +216,8 @@ int solo_set_motion_block(struct solo_dev *solo_dev, u8 ch,
int ret = 0;

buf = kzalloc(size, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
for (y = 0; y < SOLO_MOTION_SZ; y++) {
for (x = 0; x < SOLO_MOTION_SZ; x++)
buf[x] = cpu_to_le16(thresholds[y * SOLO_MOTION_SZ + x]);
--
1.8.5.5


2014-07-25 18:32:39

by Andrey Utkin

[permalink] [raw]
Subject: Re: [PATCH] drivers/media/pci/solo6x10/solo6x10-disp.c: check kzalloc() result

Please ignore. I didn't notice that Hans has already posted a patch
fixing that and more.

--
Bluecherry developer.

2014-07-26 06:13:38

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] drivers/media/pci/solo6x10/solo6x10-disp.c: check kzalloc() result

On Fri, Jul 25, 2014 at 09:32:36PM +0300, Andrey Utkin wrote:
> Please ignore. I didn't notice that Hans has already posted a patch
> fixing that and more.
>

Heh. I was just about to send my fix for this bug as well.

I don't follow linux-media so I didn't realize this driver was getting
promoted out of staging. I wish there was a way to go over drivers and
fix any basic static checker fixes before promotion.

regards,
dan carpenter

2014-07-26 13:22:00

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH] drivers/media/pci/solo6x10/solo6x10-disp.c: check kzalloc() result

Em Sat, 26 Jul 2014 09:13:12 +0300
Dan Carpenter <[email protected]> escreveu:

> On Fri, Jul 25, 2014 at 09:32:36PM +0300, Andrey Utkin wrote:
> > Please ignore. I didn't notice that Hans has already posted a patch
> > fixing that and more.
> >
>
> Heh. I was just about to send my fix for this bug as well.
>
> I don't follow linux-media so I didn't realize this driver was getting
> promoted out of staging. I wish there was a way to go over drivers and
> fix any basic static checker fixes before promotion.

When I promote a driver out of staging, I run checkpatch again, in
order to check if everything is fine. It would be nice to have a
checkpatch-like script that would also run the static checker
checks for that particular patch. With that, I could, instead,
use such script when promoting patches or handling patches adding
new files to the Kernel.

Regards,
Mauro