more get_property() fallout
PATCH 1/1 more get_property() fallout
Signed-off-by Al Viro <[email protected]>
--- drivers/video/riva/fbdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/riva/fbdev.c +1 -1
@@ -1826,7 +1826,7 @@ static int __devinit riva_get_EDID_OF(st {struct riva_par *par = info->par;struct device_node *dp; -unsigned char *pedid =NULL ; +const unsigned char *pedid =NULL ;const unsigned char *disptype =NULL ;static char *propnames[] = {"DFP,EDID" ,"LCD,EDID" ,"EDID" ,"EDID1" ,"EDID,B" ,"EDID,A" ,NULL };
Signature · 1 line
1.4.2.GIT
Quoted 10 lines · Al Viro
Signed-off-by Al Viro <[email protected]>--- drivers/video/riva/fbdev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/video/riva/fbdev.c +0
-0
drivers/video/riva/fbdev.c static int __devinit riva_get_EDID_OF(st · line 1829
Quoted 5 lines
drivers/video/riva/fbdev.c +1
-1@@ -1826,7 +1826,7 @@ static int __devinit riva_get_EDID_OF(st {struct riva_par *par = info->par;struct device_node *dp; -unsigned char *pedid =NULL ; +const unsigned char *pedid =NULL ;
Ho-hum... Actually, that looks like a genuine bug. Look:
rivafb_probe():
riva_get_EDID(info, pd); riva_get_edidinfo(info);
riva_get_EDID() -> riva_get_EDID_OF() ->
pedid = get_property(dp, propnames[i], NULL);
if (pedid != NULL) {
par->EDID = pedid;
NVTRACE("LCD found.\n");
return 1;
}
then in
riva_get_edidinfo():
struct riva_par *par = info->par;
fb_edid_to_monspecs(par->EDID, &info->monspecs);fb_edid_to_monspecs() -> edid_checksum() -> fix_edid() -> modifies the string.
What's worse, fb_edid_to_monspecs() appears to assume that the string it got is long enough. So... what the hell is going on there? I'd probably did kmalloc() and copy that sucker there, making sure that it _is_ long enough for fbmon.c while we are at it. Other suggestions?