Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1105673pxx; Fri, 30 Oct 2020 02:05:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA2Z3Ps4NUsYd+3nLd/TOsEg7x4bn6XTF2j+sswFE2zWH4ECvgjzEOA1gTgGjPBb1UckiU X-Received: by 2002:a17:906:b110:: with SMTP id u16mr1396526ejy.55.1604048757844; Fri, 30 Oct 2020 02:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604048757; cv=none; d=google.com; s=arc-20160816; b=Xru7FAcuS6e9IejGLtogxUOQDvJ05aWOx8qyxq+le+KOPnewpOlelv3iO8gu4aHCUk 4i8vjXI6UQoiyRp0UhebBk/cMhfQAs1k1Qrrbx1njKNxE2q60vsXIFvzFS+YK4c2pdIA tGH9sTiWTapyPK6QQ8v+RKAXu7pv7PziOb8gU2KVXPVW+hEIbmFLRp91eW3T4ttglqAU jlCch5DVf2sEvGwrSZyYmPWjn8w1fcWWngNOQGp4LyzL34CPSvadQGrWFXqbEYK7cAY/ z8x4eSo2VfxEH6wDFaaYGN99F4D9YpJ9+mkbOwy/C9Wk496d3xCl9cd10irWvTNHAc3Y d1mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GFNKgtyv+YjvpUIi5VQTMsCats/5oFriHfBeWrczXUw=; b=CFkdFQ9WqdISzReug2R1Fdzt7N7bpz5irbqG7NR6YjktO3FlsSQswGjFRvXX3AzmdL bwuK/y3FxPB5weBQ1nz1OGa+eehJNF3CSUoXMp+ckGdwjUfa4ddQp2IW9xRXnQfEQHjq jlmdGWx0iVFxzGcWiozjDvnBW6FT9Poq6bvNReMOQsZ0XLqc0PXVTAJgwg4xsW/FN8Nz EHM5iEox9RkEQKxK9LpEsjvhJaMAy4XuLq0aNkdPzw2H9Vpjfl2D8huFIXmslu5BJ7u4 jGA7pnWHKxbHqA2QiyamrtYYmcAWiPNbuReFMZig96A224zYmz5z4WEM3lDfXaBNdzGX OiRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=SOb95LWK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si1699534edi.245.2020.10.30.02.05.32; Fri, 30 Oct 2020 02:05:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=SOb95LWK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726027AbgJ3JEE (ORCPT + 99 others); Fri, 30 Oct 2020 05:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbgJ3JED (ORCPT ); Fri, 30 Oct 2020 05:04:03 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C543AC0613CF for ; Fri, 30 Oct 2020 02:04:01 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id z5so6772447iob.1 for ; Fri, 30 Oct 2020 02:04:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GFNKgtyv+YjvpUIi5VQTMsCats/5oFriHfBeWrczXUw=; b=SOb95LWKG8hWwp4zxXukSwadzcJB+NJb4FLJzsAwfLWgwRx/3Qtupp7rT140TPVaZl odOkqIrTWbQ/gMtlSKmlXldR0DtEd/F7XQJF+ecNLCMfBehm2dxq7l/PtsF0qMrbfuw7 rUVi4gCzUWU5Jg3OVuy7qaNciDKr3zQnH7ubjoZXK5cMsgJqhhWLuzrkCEoITSvkDNAq oni9aVNvCbqZpDqpEQak19kIaNfwwPmp34AiLifYb35gznMDn9j1N9dO2PEsNGxkrhpd QleAkeXF9u/g2ABjqmIXBeoO8cfl2NxP8NRjZT4Cp23I8f5smIOphFpNKQS/+4J+V7nn L2oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GFNKgtyv+YjvpUIi5VQTMsCats/5oFriHfBeWrczXUw=; b=Pya0B9zPakxt+CR1u+Sj02guZXGnC3WHlaPihs8mD/aq0WCi4a4OKDFIio5p5LVaeh GIJFmxiv3OzQFbnl0vhlkvfw+mJQ91eZLUgZbXOwykCep1hs94UqXsIhF1lSUNi1JC7B kcgvvSVwwM94Unt03vWyx8zhYqheBO1uDKcwSZGeMa1MDABYlFLpmdQ7KptQMuhw6w3w /1/JqCTjVJFOPus75or2PAcZrASjdmUT8We4oONYjfI2Dsp3rTvmL/wJrdatFXYAAmae fn1xYvYGUlKe0p9Jsn4cEF7eu/0TT5AAC14fibRaxw7m0jVaBYBBu9p0ENyCSnFA2mOO 7GQw== X-Gm-Message-State: AOAM531ehgGLt/2UE4Vetkq90VkVJtfLLalqNI67ZbZtf63VE2lBTaKn miel2iv3ESjiPtJpCsPSr+Rf6BucGHoJruSIV9QURA== X-Received: by 2002:a6b:f401:: with SMTP id i1mr1047529iog.130.1604048641000; Fri, 30 Oct 2020 02:04:01 -0700 (PDT) MIME-Version: 1.0 References: <20201026122728.8522-1-brgl@bgdev.pl> <20201026131427.GF4077@smile.fi.intel.com> In-Reply-To: <20201026131427.GF4077@smile.fi.intel.com> From: Bartosz Golaszewski Date: Fri, 30 Oct 2020 10:03:50 +0100 Message-ID: Subject: Re: [PATCH] devres: zero the memory in devm_krealloc() if needed To: Andy Shevchenko Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , Linux Kernel Mailing List , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 9:05 PM Andy Shevchenko wrote: > > On Mon, Oct 26, 2020 at 01:27:28PM +0100, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > 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