mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jesper Juhl <juhl-lkml@dif.dk>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH(s)][RFC] variable size and signedness issues in ldt.c - potential problem?
Date: Mon, 12 Jan 2004 14:13:50 -0800	[thread overview]
Message-ID: <20040112141350.085d32dc.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.56.0401122243270.2130@jju_lnx.backbone.dif.dk>

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.


  reply	other threads:[~2004-01-12 22:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-07 23:20 [PATCH][RFC] " Jesper Juhl
2004-01-07 23:28 ` Jesper Juhl
2004-01-09  9:46 ` Ingo Molnar
2004-01-11  2:30   ` [PATCH(s)][RFC] " Jesper Juhl
2004-01-12 21:53     ` Jesper Juhl
2004-01-12 22:13       ` Andrew Morton [this message]
2004-01-12 22:20         ` Jesper Juhl
2004-01-12 22:39           ` Randy.Dunlap
2004-01-12 22:51             ` Jesper Juhl
2004-01-12 22:55               ` Randy.Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040112141350.085d32dc.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=juhl-lkml@dif.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®