public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: tidspbridge: fix signess error
@ 2010-10-10 17:28 Vasiliy Kulikov
  0 siblings, 0 replies; 3+ messages in thread
From: Vasiliy Kulikov @ 2010-10-10 17:28 UTC (permalink / raw)
  To: kernel-janitors
  Cc: Greg Kroah-Hartman, Fernando Guzman Lugo, devel, linux-kernel

i was unsigned, so check for (i < 0) made no sense.  Made it signed.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
 I cannot compile this driver, so it is not tested.

 drivers/staging/tidspbridge/core/dsp-mmu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/dsp-mmu.c b/drivers/staging/tidspbridge/core/dsp-mmu.c
index 3c978f9..983c95a 100644
--- a/drivers/staging/tidspbridge/core/dsp-mmu.c
+++ b/drivers/staging/tidspbridge/core/dsp-mmu.c
@@ -219,7 +219,8 @@ u32 user_to_dsp_map(struct iommu *mmu, u32 uva, u32 da, u32 size,
 				struct page **usr_pgs)
 {
 	int res, w;
-	unsigned pages, i;
+	unsigned pages;
+	int i;
 	struct vm_area_struct *vma;
 	struct mm_struct *mm = current->mm;
 	struct sg_table *sgt;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: tidspbridge: fix signess error
       [not found] <1286827491.2762.69.camel@dan>
@ 2010-10-11 20:24 ` Dan Rosenberg
  2010-10-12 16:48   ` Vasiliy Kulikov
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Rosenberg @ 2010-10-11 20:24 UTC (permalink / raw)
  To: segooon; +Cc: linux-kernel

It seems to me that in a lot of cases, signed types were used initially
with checks that the value was not below zero, but then unsigned types
were substituted due to problems later on (potentially security
related), and the checks were never removed.  Just because a check
doesn't make sense doesn't necessarily mean it's safe to revert an
unsigned type to a signed one - just be careful to make sure you're not
introducing any problems when you make these kinds of changes.  I have
no idea whether or not this is the case in this particular example.

> i was unsigned, so check for (i < 0) made no sense.  Made it signed.
> 
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> ---
>  I cannot compile this driver, so it is not tested.
>  drivers/staging/tidspbridge/core/dsp-mmu.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> diff --git a/drivers/staging/tidspbridge/core/dsp-mmu.c b/drivers/staging/tidspbridge/core/dsp-mmu.c
> index 3c978f9..983c95a 100644
> --- a/drivers/staging/tidspbridge/core/dsp-mmu.c
> +++ b/drivers/staging/tidspbridge/core/dsp-mmu.c
> @@ -219,7 +219,8 @@ u32 user_to_dsp_map(struct iommu *mmu, u32 uva, u32 da, u32 size,
>  				struct page **usr_pgs)
>  {
>  	int res, w;
> -	unsigned pages, i;
> +	unsigned pages;
> +	int i;
>  	struct vm_area_struct *vma;
>  	struct mm_struct *mm = current->mm;
>  	struct sg_table *sgt;
> -- 
> 1.7.0.4



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: tidspbridge: fix signess error
  2010-10-11 20:24 ` [PATCH] staging: tidspbridge: fix signess error Dan Rosenberg
@ 2010-10-12 16:48   ` Vasiliy Kulikov
  0 siblings, 0 replies; 3+ messages in thread
From: Vasiliy Kulikov @ 2010-10-12 16:48 UTC (permalink / raw)
  To: Dan Rosenberg; +Cc: linux-kernel

On Mon, Oct 11, 2010 at 16:24 -0400, Dan Rosenberg wrote:
> It seems to me that in a lot of cases, signed types were used initially
> with checks that the value was not below zero, but then unsigned types
> were substituted due to problems later on (potentially security
> related), and the checks were never removed.  Just because a check
> doesn't make sense doesn't necessarily mean it's safe to revert an
> unsigned type to a signed one - just be careful to make sure you're not
> introducing any problems when you make these kinds of changes.  I have
> no idea whether or not this is the case in this particular example.

i is used as the store for get_user_pages() result, which may be
-EFAULT.

> > i was unsigned, so check for (i < 0) made no sense.  Made it signed.
> > 
> > Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> > ---
> >  I cannot compile this driver, so it is not tested.
> >  drivers/staging/tidspbridge/core/dsp-mmu.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > diff --git a/drivers/staging/tidspbridge/core/dsp-mmu.c b/drivers/staging/tidspbridge/core/dsp-mmu.c
> > index 3c978f9..983c95a 100644
> > --- a/drivers/staging/tidspbridge/core/dsp-mmu.c
> > +++ b/drivers/staging/tidspbridge/core/dsp-mmu.c
> > @@ -219,7 +219,8 @@ u32 user_to_dsp_map(struct iommu *mmu, u32 uva, u32 da, u32 size,
> >  				struct page **usr_pgs)
> >  {
> >  	int res, w;
> > -	unsigned pages, i;
> > +	unsigned pages;
> > +	int i;
> >  	struct vm_area_struct *vma;
> >  	struct mm_struct *mm = current->mm;
> >  	struct sg_table *sgt;
> > -- 
> > 1.7.0.4
> 
> 

-- 
Vasiliy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-12 16:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1286827491.2762.69.camel@dan>
2010-10-11 20:24 ` [PATCH] staging: tidspbridge: fix signess error Dan Rosenberg
2010-10-12 16:48   ` Vasiliy Kulikov
2010-10-10 17:28 Vasiliy Kulikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox