[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1403359116.4076.44.camel@joe-AO725>
Date: Sat, 21 Jun 2014 06:58:36 -0700
From: Joe Perches <joe@...ches.com>
To: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
Tomi Valkeinen <tomi.valkeinen@...com>,
Jingoo Han <jg1.han@...sung.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] video: fbdev: skeletonfb.c: Adding code to managing
allocation error
(Adding Geert, who probably wrote most of this
and likely might have forgotten all of it)
On Sat, 2014-06-21 at 15:17 +0200, Rickard Strandqvist wrote:
> Adding missing code for managing a memory allocation error that may occur.
>
> This was partly found using a static code analysis program called cppcheck.
skeletonfb.c is not meant to be compiled.
It's a sample driver template.
Those /* goto error path */ lines are for
driver writers that use this to figure out
what to do.
The second return is not correct as it would
not free the first alloc'd block.
> diff --git a/drivers/video/fbdev/skeletonfb.c b/drivers/video/fbdev/skeletonfb.c
[]
> @@ -692,6 +692,7 @@ static int xxxfb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
>
> if (!info) {
> /* goto error path */
> + return -ENOMEM;
> }
>
> par = info->par;
> @@ -746,6 +747,7 @@ static int xxxfb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
> info->pixmap.addr = kmalloc(PIXMAP_SIZE, GFP_KERNEL);
> if (!info->pixmap.addr) {
> /* goto error */
> + return -ENOMEM;
> }
>
> info->pixmap.size = PIXMAP_SIZE;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists