linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: dchinner@redhat.com
Cc: linux-mm@kvack.org
Subject: Re: list_lru: per-node list infrastructure
Date: Wed, 17 Jul 2013 14:20:58 +0300	[thread overview]
Message-ID: <20130717112058.GA12134@mwanda> (raw)
In-Reply-To: <20130628142202.GA16774@elgon.mountain>

Ping?

Btw, here is the code from list_lru_walk_node():

		if ((*nr_to_walk)-- == 0)
			break;

As you can see it wraps to ULONG_MAX before returning.

regards,
dan carpenter

On Fri, Jun 28, 2013 at 05:22:02PM +0300, Dan Carpenter wrote:
> Hi Dave,
> 
> The patch a8739514fa91: "list_lru: per-node list infrastructure" in -mm
> has a signedness bug.
> 
> include/linux/list_lru.h
>    116  static inline unsigned long
>    117  list_lru_walk(struct list_lru *lru, list_lru_walk_cb isolate,
>    118                void *cb_arg, unsigned long nr_to_walk)
>    119  {
>    120          long isolated = 0;
>    121          int nid;
>    122  
>    123          for_each_node_mask(nid, lru->active_nodes) {
>    124                  isolated += list_lru_walk_node(lru, nid, isolate,
>    125                                                 cb_arg, &nr_to_walk);
>    126                  if (nr_to_walk <= 0)
>                             ^^^^^^^^^^^^^^^
> nr_to_walk is unsigned so the timeout value from list_lru_walk_node() is
> ULONG_MAX (it's not zero).
> 
>    127                          break;
>    128          }
>    129          return isolated;
>    130  }
> 
> regards,
> dan carpenter

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2013-07-17 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 14:22 Dan Carpenter
2013-07-17 11:20 ` Dan Carpenter [this message]

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=20130717112058.GA12134@mwanda \
    --to=error27@gmail.com \
    --cc=dchinner@redhat.com \
    --cc=linux-mm@kvack.org \
    /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