lkml.org 
[lkml]   [2004]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH(s)][RFC] variable size and signedness issues in ldt.c - potential problem?
Jesper Juhl <juhl-lkml@dif.dk> wrote:
>
>
> >
> > -static int read_ldt(void __user * ptr, unsigned long bytecount)
> > +static int read_ldt(void __user *ptr, unsigned long bytecount)
> > {
> > int err, i;
> > unsigned long size;
> > + unsigned long bytes;
> > struct mm_struct * mm = current->mm;
> >
> > if (!mm->context.size)
> > @@ -144,7 +145,7 @@ static int read_ldt(void __user * ptr, u
> > __flush_tlb_global();
> >
> > for (i = 0; i < size; i += PAGE_SIZE) {
> > - int nr = i / PAGE_SIZE, bytes;
> > + int nr = i / PAGE_SIZE;
> > char *kaddr = kmap(mm->context.ldt_pages[nr]);
> >
> > bytes = size - i;
> >

There is no additional overhead with the original code and it has the
advantage that the scope of `bytes' covers the minimum amount of code. I
see no need to change this.

Well. There is a little bit of overhead of the code does:

foo()
{
...
{
int i;
...
}
...
{
int i;
...
}
...
}

because the compiler (some versions, at least) will use eight bytes of
stack rather than four. But this is rarely a problem.

> After creating the initial cleanup patch I've noticed several more
> instances of this 'bad style'. If there's any interrest in cleaning them
> up I'll be happy to create a patch. Is this wanted?

I'd say that this and the whitespace adjustments are far too trivial to be
raising patches at this time.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:00    [W:0.046 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site