[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zj3-8GHR_EiWY7lB@google.com>
Date: Fri, 10 May 2024 12:03:12 +0100
From: Vincent Donnefort <vdonnefort@...gle.com>
To: David Hildenbrand <david@...hat.com>
Cc: Steven Rostedt <rostedt@...dmis.org>, mhiramat@...nel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
mathieu.desnoyers@...icios.com, kernel-team@...roid.com,
rdunlap@...radead.org, rppt@...nel.org, linux-mm@...ck.org
Subject: Re: [PATCH v22 2/5] ring-buffer: Introducing ring-buffer mapping
functions
[...]
> > > +
> > > + while (s < nr_subbufs && p < nr_pages) {
> > > + struct page *page = virt_to_page(cpu_buffer->subbuf_ids[s]);
> > > + int off = 0;
> > > +
> > > + for (; off < (1 << (subbuf_order)); off++, page++) {
> > > + if (p >= nr_pages)
> > > + break;
> > > +
> > > + pages[p++] = page;
> > > + }
> > > + s++;
> > > + }
> >
> > The above can be made to:
> >
> > while (p < nr_pages) {
> > struct page *page;
> > int off = 0;
> >
> > if (WARN_ON_ONCE(s >= nr_subbufs))
> > break;
>
> I'm not particularly happy about us calling vm_insert_pages with NULL
> pointers stored in pages.
>
> Should we instead do
>
> if (WARN_ON_ONCE(s >= nr_subbufs)) {
> err = -EINVAL;
> goto out;
> }
>
> ?
I could also nr_pages = p in the event of s >= nr_subbufs... but that
really that shouldn't happen so let's return an error.
>
> --
> Cheers,
>
> David / dhildenb
>
Powered by blists - more mailing lists