[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94D0CD8314A33A4D9D801C0FE68B40295BEC9A58@G9W0745.americas.hpqcorp.net>
Date: Thu, 24 Dec 2015 00:28:24 +0000
From: "Elliott, Robert (Persistent Memory)" <elliott@....com>
To: Ross Zwisler <ross.zwisler@...ux.intel.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Dave Hansen <dave.hansen@...ux.intel.com>,
Dave Chinner <david@...morbit.com>,
"J. Bruce Fields" <bfields@...ldses.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Andreas Dilger <adilger.kernel@...ger.ca>,
"H. Peter Anvin" <hpa@...or.com>,
Jeff Layton <jlayton@...chiereds.net>,
"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
"x86@...nel.org" <x86@...nel.org>, Ingo Molnar <mingo@...hat.com>,
"linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
"xfs@....sgi.com" <xfs@....sgi.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Thomas Gleixner <tglx@...utronix.de>,
Theodore Ts'o <tytso@....edu>, Jan Kara <jack@...e.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <matthew.r.wilcox@...el.com>
Subject: RE: [PATCH v6 3/7] mm: add find_get_entries_tag()
> -----Original Message-----
> From: Linux-nvdimm [mailto:linux-nvdimm-bounces@...ts.01.org] On Behalf Of
> Ross Zwisler
> Sent: Wednesday, December 23, 2015 1:39 PM
> Subject: [PATCH v6 3/7] mm: add find_get_entries_tag()
>
...
> diff --git a/mm/filemap.c b/mm/filemap.c
...
> +unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start,
> + int tag, unsigned int nr_entries,
> + struct page **entries, pgoff_t *indices)
> +{
> + void **slot;
> + unsigned int ret = 0;
...
> + radix_tree_for_each_tagged(slot, &mapping->page_tree,
> + &iter, start, tag) {
...
> + indices[ret] = iter.index;
> + entries[ret] = page;
> + if (++ret == nr_entries)
> + break;
> + }
Using >= would provide more safety from buffer overflow
problems in case ret ever jumped ahead by more than one.
---
Robert Elliott, HPE Persistent Memory
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists