* [patch] viafb: NULL dereference on allocation failure in query_edid()
@ 2012-02-17 6:45 Dan Carpenter
2012-02-17 7:30 ` Florian Tobias Schandinat
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-02-17 6:45 UTC (permalink / raw)
To: linux-fbdev
We should handle the allocation here, if only to keep the static
checkers happy.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/video/via/via_aux_edid.c b/drivers/video/via/via_aux_edid.c
index 03f7a41..754d450 100644
--- a/drivers/video/via/via_aux_edid.c
+++ b/drivers/video/via/via_aux_edid.c
@@ -36,10 +36,13 @@ static void query_edid(struct via_aux_drv *drv)
unsigned char edid[EDID_LENGTH];
bool valid = false;
- if (spec)
+ if (spec) {
fb_destroy_modedb(spec->modedb);
- else
+ } else {
spec = kmalloc(sizeof(*spec), GFP_KERNEL);
+ if (!spec)
+ return;
+ }
spec->version = spec->revision = 0;
if (via_aux_read(drv, 0x00, edid, EDID_LENGTH)) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] viafb: NULL dereference on allocation failure in query_edid()
2012-02-17 6:45 [patch] viafb: NULL dereference on allocation failure in query_edid() Dan Carpenter
@ 2012-02-17 7:30 ` Florian Tobias Schandinat
0 siblings, 0 replies; 2+ messages in thread
From: Florian Tobias Schandinat @ 2012-02-17 7:30 UTC (permalink / raw)
To: linux-fbdev
On 02/17/2012 06:45 AM, Dan Carpenter wrote:
> We should handle the allocation here, if only to keep the static
> checkers happy.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Ah, thanks for noticing it and sorry that I introduced it in the first place.
Applied.
Thanks,
Florian Tobias Schandinat
>
> diff --git a/drivers/video/via/via_aux_edid.c b/drivers/video/via/via_aux_edid.c
> index 03f7a41..754d450 100644
> --- a/drivers/video/via/via_aux_edid.c
> +++ b/drivers/video/via/via_aux_edid.c
> @@ -36,10 +36,13 @@ static void query_edid(struct via_aux_drv *drv)
> unsigned char edid[EDID_LENGTH];
> bool valid = false;
>
> - if (spec)
> + if (spec) {
> fb_destroy_modedb(spec->modedb);
> - else
> + } else {
> spec = kmalloc(sizeof(*spec), GFP_KERNEL);
> + if (!spec)
> + return;
> + }
>
> spec->version = spec->revision = 0;
> if (via_aux_read(drv, 0x00, edid, EDID_LENGTH)) {
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-17 7:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-17 6:45 [patch] viafb: NULL dereference on allocation failure in query_edid() Dan Carpenter
2012-02-17 7:30 ` Florian Tobias Schandinat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).