lkml.org 
[lkml]   [2020]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] devres: zero the memory in devm_krealloc() if needed
On Thu, Oct 29, 2020 at 9:05 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Oct 26, 2020 at 01:27:28PM +0100, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > If we're returning the same pointer (when new size is smaller or equal
> > to the old size) we need to check if the user wants the memory zeroed
> > and memset() it manually if so.
>
> Any use case? Because to me it sounds contradictory to the whole idea of [k]realloc().
>

This is kind of a gray area in original krealloc() too and I want to
submit a patch for mm too. Right now krealloc ignores the __GFP_ZERO
flag if new_size <= old_size but zeroes the memory if new_size >
old_size. This should be consistent - either ignore __GFP_ZERO or
don't ignore it in both cases. I think that not ignoring it is better
- if user passes it then it's for a reason.

Bartosz

\
 
 \ /
  Last update: 2020-10-30 10:04    [W:0.053 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site