video: fbdev: uvesafb: use CONFIG_X86_PAE surround _PAGE_NX check code
Subsystems (2)
PATCH 1/1 video: fbdev: uvesafb: use CONFIG_X86_PAE surround _PAGE_NX check code
Because _PAGE_NX check will always false when we don't define CONFIG_X86_PAE for CONFIG_X86_32, so use CONFIG_X86_PAE surround the check code.
Although I believe "smart" compile will optimize out and generate the same code, but use CONFIG_X86_PAE surround check code will clear it and prohibit warning from static source code analyze tool.
[ This patch fix warning report by [email protected]
"drivers/video/fbdev/uvesafb.c:816 uvesafb_vbe_init()
warn: bitwise AND condition is false here" ]
--- drivers/video/fbdev/uvesafb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/video/fbdev/uvesafb.c +4 -0
@@ -813,6 +813,7 @@ static int uvesafb_vbe_init(struct fb_info *info) par->ypan = ypan;if (par->pmi_setpal || par->ypan) { +#ifdef CONFIG_X86_PAE if (__supported_pte_mask & _PAGE_NX) { par->pmi_setpal = par->ypan =0 ; printk(KERN_WARNING "uvesafb: NX protection is active, "
@@ -820,6 +821,9 @@ static int uvesafb_vbe_init(struct fb_info *info) } else {uvesafb_vbe_getpmi (task, par); } +#else +uvesafb_vbe_getpmi (task, par); +#endif }#else /* The protected mode interface is not available on non-x86. */
Signature · 1 line
1.8.3.4.8.g69490f3.dirty
Quoted 30 lines · Wang YanQing
Because
_PAGE_NXcheck will always false when we don't defineCONFIG_X86_PAEforCONFIG_X86_32, so useCONFIG_X86_PAEsurround the check code.Although I believe "smart" compile will optimize out and generate the same code, but use
CONFIG_X86_PAEsurround check code will clear it and prohibit warning from static source code analyze tool.[ This patch fix warning report by [email protected]
"drivers/video/fbdev/uvesafb.c:816uvesafb_vbe_init()
warn: bitwise AND condition is false here" ]Signed-off-by Wang YanQing <[email protected]>--- drivers/video/fbdev/uvesafb.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/video/fbdev/uvesafb.c +1
-0@@ -813,6 +813,7 @@ static int uvesafb_vbe_init(struct fb_info *info) par->ypan = ypan;if (par->pmi_setpal || par->ypan) { +#ifdef CONFIG_X86_PAE if (__supported_pte_mask & _PAGE_NX) { par->pmi_setpal = par->ypan =0 ; printk(KERN_WARNING "uvesafb: NX protection is active, "
drivers/video/fbdev/uvesafb.c static int uvesafb_vbe_init(struct fb_info *info) · line 827
Quoted 7 lines
drivers/video/fbdev/uvesafb.c +3
-0@@ -820,6 +821,9 @@ static int uvesafb_vbe_init(struct fb_info *info) } else {uvesafb_vbe_getpmi (task, par); } +#else +uvesafb_vbe_getpmi (task, par); +#endif }
I don't like this, I think this makes the code more messy, just to avoid that warning.
And it might even be buggy. For your patch to work correctly, you need to know the internals of _PAGE_NX, i.e. that when CONFIG_X86_PAE is not defined, _PAGE_NX is 0. But the driver should not depend on things like that. If _PAGE_NX is changed later, the driver will not work correctly.
Tomi
Quoted 8 lines · Tomi Valkeinen
I don't like this, I think this makes the code more messy, just to avoid that warning.
And it might even be buggy. For your patch to work correctly, you need to know the internals of
_PAGE_NX, i.e. that whenCONFIG_X86_PAEis not defined,_PAGE_NXis 0. But the driver should not depend on things like that. If_PAGE_NXis changed later, the driver will not work correctly.
Very right! Thanks.