* [PATCH] video: fbdev: uvesafb: use CONFIG_X86_PAE surround _PAGE_NX check code
@ 2014-03-05 16:16 Wang YanQing
2014-03-06 9:56 ` Tomi Valkeinen
0 siblings, 1 reply; 3+ messages in thread
From: Wang YanQing @ 2014-03-05 16:16 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: plagnioj, fengguang.wu, linux-fbdev, linux-kernel
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 fengguang.wu@intel.com
"drivers/video/fbdev/uvesafb.c:816 uvesafb_vbe_init()
warn: bitwise AND condition is false here" ]
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
drivers/video/fbdev/uvesafb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
index 509d452..102858c 100644
--- a/drivers/video/fbdev/uvesafb.c
+++ b/drivers/video/fbdev/uvesafb.c
@@ -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. */
--
1.8.3.4.8.g69490f3.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] video: fbdev: uvesafb: use CONFIG_X86_PAE surround _PAGE_NX check code
2014-03-05 16:16 [PATCH] video: fbdev: uvesafb: use CONFIG_X86_PAE surround _PAGE_NX check code Wang YanQing
@ 2014-03-06 9:56 ` Tomi Valkeinen
2014-03-06 10:33 ` Wang YanQing
0 siblings, 1 reply; 3+ messages in thread
From: Tomi Valkeinen @ 2014-03-06 9:56 UTC (permalink / raw)
To: Wang YanQing; +Cc: plagnioj, fengguang.wu, linux-fbdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]
On 05/03/14 18:16, Wang YanQing wrote:
> 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 fengguang.wu@intel.com
> "drivers/video/fbdev/uvesafb.c:816 uvesafb_vbe_init()
> warn: bitwise AND condition is false here" ]
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
> drivers/video/fbdev/uvesafb.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
> index 509d452..102858c 100644
> --- a/drivers/video/fbdev/uvesafb.c
> +++ b/drivers/video/fbdev/uvesafb.c
> @@ -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
> }
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] video: fbdev: uvesafb: use CONFIG_X86_PAE surround _PAGE_NX check code
2014-03-06 9:56 ` Tomi Valkeinen
@ 2014-03-06 10:33 ` Wang YanQing
0 siblings, 0 replies; 3+ messages in thread
From: Wang YanQing @ 2014-03-06 10:33 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: plagnioj, fengguang.wu, linux-fbdev, linux-kernel
On Thu, Mar 06, 2014 at 11:56:37AM +0200, Tomi Valkeinen wrote:
> 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.
>
Very right! Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-06 10:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05 16:16 [PATCH] video: fbdev: uvesafb: use CONFIG_X86_PAE surround _PAGE_NX check code Wang YanQing
2014-03-06 9:56 ` Tomi Valkeinen
2014-03-06 10:33 ` Wang YanQing
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).