Re: [PATCH] fbdev: fix possible NULL pointer derefernce
flat view
From: DaeSeok Youn <hidden>
Date: 2014-04-17 00:00:57
Also in:
lkml
Hello, 2014-04-16 21:38 GMT+09:00 Jean-Christophe PLAGNIOL-VILLARD [off-list ref]:
On Apr 16, 2014, at 5:40 PM, Daeseok Youn [off-list ref] wrote:quoted
The spec->modedb can be NULL by fb_create_modedb(). And also smatch says: drivers/video/fbdev/core/fbmon.c:975 fb_edid_to_monspecs() error: potential null dereference 'specs->modedb'. (fb_create_modedb returns null) Signed-off-by: Daeseok Youn <redacted> --- drivers/video/fbdev/core/fbmon.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c index c204ebe..db274ca 100644 --- a/drivers/video/fbdev/core/fbmon.c +++ b/drivers/video/fbdev/core/fbmon.c@@ -966,6 +966,9 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs) specs->modedb = fb_create_modedb(edid, &specs->modedb_len); + if (!specs->modedb) + return; +we need to return an error and trace it
Yes, you're right. I will change return type from void to int and add to handle an error when this function(fb_edid_to_monspecs) is called. I will send this patch as your comment. Thanks for review. Daeseok Youn.
Best Regards, J.quoted
/* * Workaround for buggy EDIDs that sets that the first * detailed timing is preferred but has not detailed -- 1.7.4.4