* [PATCH] ttm: Fix a potential comparison of structs. @ 2009-07-31 8:47 Thomas Hellstrom 2009-08-02 17:36 ` Pekka Paalanen 0 siblings, 1 reply; 4+ messages in thread From: Thomas Hellstrom @ 2009-07-31 8:47 UTC (permalink / raw) To: dri-devel, linux-kernel; +Cc: Thomas Hellstrom On some architectures the comparison may cause a compilation failure. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> --- drivers/gpu/drm/ttm/ttm_bo_util.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index ce2e6f3..ee9a281 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -150,7 +150,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, #ifdef CONFIG_X86 dst = kmap_atomic_prot(d, KM_USER0, prot); #else - if (prot != PAGE_KERNEL) + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) dst = vmap(&d, 1, 0, prot); else dst = kmap(d); @@ -163,7 +163,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, #ifdef CONFIG_X86 kunmap_atomic(dst, KM_USER0); #else - if (prot != PAGE_KERNEL) + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) vunmap(dst); else kunmap(d); -- 1.6.1.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ttm: Fix a potential comparison of structs. 2009-07-31 8:47 [PATCH] ttm: Fix a potential comparison of structs Thomas Hellstrom @ 2009-08-02 17:36 ` Pekka Paalanen 2009-08-02 18:12 ` Thomas Hellström 0 siblings, 1 reply; 4+ messages in thread From: Pekka Paalanen @ 2009-08-02 17:36 UTC (permalink / raw) To: dri-devel; +Cc: Thomas Hellstrom, linux-kernel, Dave Airlie >From 5e2851952729b287a82efa002b28a2095404d44d Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom <thellstrom@vmware.com> Date: Fri, 31 Jul 2009 10:47:51 +0200 Subject: [PATCH] ttm: Fix a potential comparison of structs. On some architectures the comparison may cause a compilation failure. Original partial fix Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Pekka Paalanen <pq@iki.fi> --- Thomas, you forgot two more of these :-) Here's a patch that actually compiles on x86_64. drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index f4e2eba..999fbe7 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -151,7 +151,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, #ifdef CONFIG_X86 dst = kmap_atomic_prot(d, KM_USER0, prot); #else - if (prot != PAGE_KERNEL) + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) dst = vmap(&d, 1, 0, prot); else dst = kmap(d); @@ -164,7 +164,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, #ifdef CONFIG_X86 kunmap_atomic(dst, KM_USER0); #else - if (prot != PAGE_KERNEL) + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) vunmap(dst); else kunmap(d); @@ -187,7 +187,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, #ifdef CONFIG_X86 src = kmap_atomic_prot(s, KM_USER0, prot); #else - if (prot != PAGE_KERNEL) + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) src = vmap(&s, 1, 0, prot); else src = kmap(s); @@ -200,7 +200,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, #ifdef CONFIG_X86 kunmap_atomic(src, KM_USER0); #else - if (prot != PAGE_KERNEL) + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) vunmap(src); else kunmap(s); -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ttm: Fix a potential comparison of structs. 2009-08-02 17:36 ` Pekka Paalanen @ 2009-08-02 18:12 ` Thomas Hellström 2009-08-02 19:21 ` Pekka Paalanen 0 siblings, 1 reply; 4+ messages in thread From: Thomas Hellström @ 2009-08-02 18:12 UTC (permalink / raw) To: Pekka Paalanen Cc: dri-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Dave Airlie Pekka Paalanen skrev: > From 5e2851952729b287a82efa002b28a2095404d44d Mon Sep 17 00:00:00 2001 > From: Thomas Hellstrom <thellstrom@vmware.com> > Date: Fri, 31 Jul 2009 10:47:51 +0200 > Subject: [PATCH] ttm: Fix a potential comparison of structs. > > On some architectures the comparison may cause a compilation failure. > > Original partial fix Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> > > Signed-off-by: Pekka Paalanen <pq@iki.fi> > --- > > Thomas, you forgot two more of these :-) > Here's a patch that actually compiles on x86_64. > Pekka, Thanks for fixing this! (Just for clarity, i assume you mean that the non-x86 part now compiles on x86?) Dave, is there a chance to have this in 2.6.31? Compilation errors are bad, although probably nobody has been hitting this yet.. /Thomas > drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c > index f4e2eba..999fbe7 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c > @@ -151,7 +151,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, > #ifdef CONFIG_X86 > dst = kmap_atomic_prot(d, KM_USER0, prot); > #else > - if (prot != PAGE_KERNEL) > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > dst = vmap(&d, 1, 0, prot); > else > dst = kmap(d); > @@ -164,7 +164,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, > #ifdef CONFIG_X86 > kunmap_atomic(dst, KM_USER0); > #else > - if (prot != PAGE_KERNEL) > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > vunmap(dst); > else > kunmap(d); > @@ -187,7 +187,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, > #ifdef CONFIG_X86 > src = kmap_atomic_prot(s, KM_USER0, prot); > #else > - if (prot != PAGE_KERNEL) > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > src = vmap(&s, 1, 0, prot); > else > src = kmap(s); > @@ -200,7 +200,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, > #ifdef CONFIG_X86 > kunmap_atomic(src, KM_USER0); > #else > - if (prot != PAGE_KERNEL) > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > vunmap(src); > else > kunmap(s); > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ttm: Fix a potential comparison of structs. 2009-08-02 18:12 ` Thomas Hellström @ 2009-08-02 19:21 ` Pekka Paalanen 0 siblings, 0 replies; 4+ messages in thread From: Pekka Paalanen @ 2009-08-02 19:21 UTC (permalink / raw) To: Thomas Hellström Cc: dri-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Dave Airlie On Sun, 02 Aug 2009 20:12:18 +0200 Thomas Hellström <thellstrom@vmware.com> wrote: > Pekka Paalanen skrev: > > From 5e2851952729b287a82efa002b28a2095404d44d Mon Sep 17 00:00:00 2001 > > From: Thomas Hellstrom <thellstrom@vmware.com> > > Date: Fri, 31 Jul 2009 10:47:51 +0200 > > Subject: [PATCH] ttm: Fix a potential comparison of structs. > > > > On some architectures the comparison may cause a compilation failure. > > > > Original partial fix Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> > > > > Signed-off-by: Pekka Paalanen <pq@iki.fi> > > --- > > > > Thomas, you forgot two more of these :-) > > Here's a patch that actually compiles on x86_64. > > > > Pekka, > Thanks for fixing this! (Just for clarity, i assume you mean that the > non-x86 part now compiles on x86?) Ah yes, that's what I mean. I changed the #ifdefs for my compat fix in http://cgit.freedesktop.org/nouveau/linux-2.6/log/?h=master-compat and tried compiling it the both ways. > Dave, is there a chance to have this in 2.6.31? Compilation errors are > bad, although probably nobody has been hitting this yet.. Well, Nouveau master-compat users would have hit it, but I added your fix, too. Users with x86_32 highmem kernels already hit the kmap_atomic_prot not exported bug while building the latest DRM, TTM and Nouveau bits against distro kernels. So yeah, no-one anyone (else) would care about ;-) Thanks. > > /Thomas > > > drivers/gpu/drm/ttm/ttm_bo_util.c | 8 ++++---- > > 1 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c > > index f4e2eba..999fbe7 100644 > > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c > > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c > > @@ -151,7 +151,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, > > #ifdef CONFIG_X86 > > dst = kmap_atomic_prot(d, KM_USER0, prot); > > #else > > - if (prot != PAGE_KERNEL) > > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > > dst = vmap(&d, 1, 0, prot); > > else > > dst = kmap(d); > > @@ -164,7 +164,7 @@ static int ttm_copy_io_ttm_page(struct ttm_tt *ttm, void *src, > > #ifdef CONFIG_X86 > > kunmap_atomic(dst, KM_USER0); > > #else > > - if (prot != PAGE_KERNEL) > > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > > vunmap(dst); > > else > > kunmap(d); > > @@ -187,7 +187,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, > > #ifdef CONFIG_X86 > > src = kmap_atomic_prot(s, KM_USER0, prot); > > #else > > - if (prot != PAGE_KERNEL) > > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > > src = vmap(&s, 1, 0, prot); > > else > > src = kmap(s); > > @@ -200,7 +200,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, > > #ifdef CONFIG_X86 > > kunmap_atomic(src, KM_USER0); > > #else > > - if (prot != PAGE_KERNEL) > > + if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) > > vunmap(src); > > else > > kunmap(s); -- Pekka Paalanen http://www.iki.fi/pq/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-02 19:20 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-31 8:47 [PATCH] ttm: Fix a potential comparison of structs Thomas Hellstrom 2009-08-02 17:36 ` Pekka Paalanen 2009-08-02 18:12 ` Thomas Hellström 2009-08-02 19:21 ` Pekka Paalanen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox