mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Peter Firefly Lund <firefly@vax64.dk>
Cc: Christoph Lameter <clameter@sgi.com>,
	Christoph Hellwig <hch@infradead.org>,
	trivial@kernel.org, linux-kernel@vger.kernel.org,
	Momchil Velikov <velco@fadata.bg>
Subject: Re: [LV] [PATCH] avoid negative shifts in radix-tree.c
Date: Sun, 26 Aug 2007 18:01:25 +0200	[thread overview]
Message-ID: <20070826160125.GQ11718@lug-owl.de> (raw)
In-Reply-To: <1188051967.18306.45.camel@ls-search>

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

On Sat, 2007-08-25 16:26:07 +0200, Peter Firefly Lund <firefly@vax64.dk> wrote:
> --- lib/radix-tree-old.c	2007-08-25 15:36:40.000000000 +0200
> +++ lib/radix-tree.c	2007-08-25 15:36:51.000000000 +0200
> @@ -980,12 +980,14 @@ radix_tree_node_ctor(void *node, struct 
>  
>  static __init unsigned long __maxindex(unsigned int height)
>  {
> -	unsigned int tmp = height * RADIX_TREE_MAP_SHIFT;
> -	unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1;
> -
> -	if (tmp >= RADIX_TREE_INDEX_BITS)
> -		index = ~0UL;
> -	return index;
> +	unsigned int	tmp   = 
> +	int shift = RADIX_TREE_INDEX_BITS - height * RADIX_TREE_MAP_SHIFT;
> +	unsigned long	index;
> +
> +	if (shift < 0)
> +		return ~0UL;
> +	else
> +		return ~0UL >> shift;
>  }
>  
>  static __init void radix_tree_init_maxindex(void)

`index' seems to be unused now?  And indention does neither follow
kernel coding style, nor this file's style. You'd also hammer out
`tmp' and put its initializer right there where it's used.

MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
Signature of:               Träume nicht von Dein Leben: Lebe Deinen Traum!
the second  :

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-08-26 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-25 14:26 Peter Firefly Lund
2007-08-26 16:01 ` Jan-Benedict Glaw [this message]
2007-08-27 13:28 ` Christoph Hellwig
2007-08-29 11:39   ` Maciej W. Rozycki

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=20070826160125.GQ11718@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=clameter@sgi.com \
    --cc=firefly@vax64.dk \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@kernel.org \
    --cc=velco@fadata.bg \
    /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®