* [patch v2] tgafb: potential NULL dereference in init
@ 2013-12-16 9:49 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2013-12-16 9:49 UTC (permalink / raw)
To: linux-fbdev
Static checkers complain that there are paths where "tga_type_name" can
be NULL. I've re-arranged the code slightly so that's impossible.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v1: had introduced a "dereferencing uninitialized variable" bug. Thanks
to Geert Uytterhoeven for catching that.
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
index f28674fea909..afd8887fd656 100644
--- a/drivers/video/tgafb.c
+++ b/drivers/video/tgafb.c
@@ -1496,10 +1496,9 @@ tgafb_init_fix(struct fb_info *info)
if (tga_bus_tc)
tga_type_name = "Digital ZLX-E3";
break;
- default:
- tga_type_name = "Unknown";
- break;
}
+ if (!tga_type_name)
+ tga_type_name = "Unknown";
strlcpy(info->fix.id, tga_type_name, sizeof(info->fix.id));
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch v2] tgafb: potential NULL dereference in init
@ 2014-01-10 11:33 Tomi Valkeinen
0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2014-01-10 11:33 UTC (permalink / raw)
To: linux-fbdev
[-- Attachment #1: Type: text/plain, Size: 925 bytes --]
On 2013-12-16 11:49, Dan Carpenter wrote:
> Static checkers complain that there are paths where "tga_type_name" can
> be NULL. I've re-arranged the code slightly so that's impossible.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v1: had introduced a "dereferencing uninitialized variable" bug. Thanks
> to Geert Uytterhoeven for catching that.
>
> diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
> index f28674fea909..afd8887fd656 100644
> --- a/drivers/video/tgafb.c
> +++ b/drivers/video/tgafb.c
> @@ -1496,10 +1496,9 @@ tgafb_init_fix(struct fb_info *info)
> if (tga_bus_tc)
> tga_type_name = "Digital ZLX-E3";
> break;
> - default:
> - tga_type_name = "Unknown";
> - break;
> }
> + if (!tga_type_name)
> + tga_type_name = "Unknown";
>
> strlcpy(info->fix.id, tga_type_name, sizeof(info->fix.id));
>
>
Queued for 3.14.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-10 11:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-16 9:49 [patch v2] tgafb: potential NULL dereference in init Dan Carpenter
2014-01-10 11:33 Tomi Valkeinen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.