Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2976571pxb; Mon, 16 Nov 2020 02:21:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzatb0CqoAChjmhsYYQvUnvagGqGBrv977vB9QMKfYtoj2RQecmPAYBuxbU/frqpZxQJy5z X-Received: by 2002:a17:906:31cb:: with SMTP id f11mr13593664ejf.142.1605522088221; Mon, 16 Nov 2020 02:21:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605522088; cv=none; d=google.com; s=arc-20160816; b=S7n15UXpKYFM/NGd1s3t0Sq4ylsIT00nm80O6AJWixNd90poBZCh8lNcpveJFkX7I+ gr8rt0LeOmQ+yr2SImDBoDYs32JECJrsOnYJcNjti/Xmi+naxnbU/NzEjEinC6mZfSRY htCDoK9zNqQYxbTR42m1q9JXOCJpAPRvU3Ms61Hny2a8oA/Aspu/lRZyRhZzIMY7yZxH 8lhs4Nr+zMMKbcUNcnqKWolzgIMZDu4ZoPdF8BxRtfa4K2LsTD6gKlvqteyVfE59f94s aiZS6CzoEkyknZS+Z46wZBbUkVxISE/PmYgGPmvn+7Mh6keREnP1vVq4ua27qPv/nllF Wqzw== 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=TyZ9ZtY9yDgRe9DpEP4oC7xWjfKvJWnIXoJrIOMjIkM=; b=YK8u26pWl5YwY/g/Ym6meGZzwZs1izKCO8AO1fEFyPxGSF5r8tWfxw6n0Z39cDtnkk NfepFh42oHgMlMVPdIau5o2W3z6Qs1f0n5cBujgjXmYwxwIN2RVgOY49ELnHMH5B9Eai 8Va4hb9BQMb3ZMdg+Fex8oHzhqThskkhFSEdzjXtLcWaFj1jmryW7g+v72s2rJ6OsbTR 7w9Xnoj8y5R9j7ZhEuXwd0S9si/iayZhcYrIYZlaHWm12jStFQEvRYLrMARl1vRwjkav 6kRlSLNkFOmd4iVS9biFms4+a0xr8JEi0gCWw9y2G4Swf0nPTRd9/xA3MC2EMEGbX3k/ OwSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PkJTo5hd; 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 do13si6222537ejc.286.2020.11.16.02.21.05; Mon, 16 Nov 2020 02:21:28 -0800 (PST) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PkJTo5hd; 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 S1728682AbgKPKSR (ORCPT + 99 others); Mon, 16 Nov 2020 05:18:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728589AbgKPKSQ (ORCPT ); Mon, 16 Nov 2020 05:18:16 -0500 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B00C0613CF for ; Mon, 16 Nov 2020 02:18:15 -0800 (PST) Received: by mail-ej1-x642.google.com with SMTP id 7so23609670ejm.0 for ; Mon, 16 Nov 2020 02:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TyZ9ZtY9yDgRe9DpEP4oC7xWjfKvJWnIXoJrIOMjIkM=; b=PkJTo5hd6B4iKdg2XokVVhnfHJ5+hL8dhjkCk40O6MvB/TmPrYsNzxbomBBjRDtxs7 KkvzLncB3zORojtr5jzaoii6NbmB6GhDcJG/amMbYdVkwiMuRS1pXvZzybwHdhpbd4dC 9itDv9Msio9jXMRqlcFCPqBsWCu4sJaSiI33jxyUKvEM/rMRvdjjQk6CDGiqmxTM/aUH oz+4wkiRKKUYHaO/wTHE51XLC/Yotd07i4Wvd42QvlhGZ3NZoy+wURsYq1lS+slERM+p jjHvKUsJAydn6/zqTjO6oDSLf6XFCjRT2uLUo5Dq6zd5Ap+DBV6Tr4dPB9bzg+LCTpRg Ro+A== 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=TyZ9ZtY9yDgRe9DpEP4oC7xWjfKvJWnIXoJrIOMjIkM=; b=Z2cXZyTIfo/PUFe/9uLFcG5KeYCjlAuBryW6y9jX+3oFRcA2uGqDBNIRC1MfXbroBy CQNo2DO4ojk0UAfQiivW6WyDS3Tu8Ieb1Unu+HAeqjTHtAPwdpfR/ZLHJF92EHCvi5QV mfvesX+9+n5Q+9UWQ9cN6Vsnjq0ROCP8iEIsUlX4LdfsP9S7AAZ4SVXJxmdlN1/2WTnf eMlvALhyKZ6RRxhBuGRbxmgWzGWSrQBEclOC2kalkDnsy4tVGxBMsLjgzMgPeFvzSE8i tN1hRp+6rCh62CDQwTED9YX6+Nyh4JA0PB7BiMRhgnieHIcxclJFdLpJ+fddiV2wbn/t 3tAQ== X-Gm-Message-State: AOAM531/h5lJkN13h+IxaMWIKeRSUkaxPKwBXYBwH7LJxrkj5ypsLHyy YZGLYS0dKHIwbJMR2Tk6dlLcrKL1ykxO/UIK9XSwoA== X-Received: by 2002:a17:906:14d:: with SMTP id 13mr13916968ejh.516.1605521894586; Mon, 16 Nov 2020 02:18:14 -0800 (PST) MIME-Version: 1.0 References: <20201102142228.14949-1-brgl@bgdev.pl> <20201102142228.14949-2-brgl@bgdev.pl> <20201114154641.0258f4ee@archlinux> In-Reply-To: From: Bartosz Golaszewski Date: Mon, 16 Nov 2020 11:18:03 +0100 Message-ID: Subject: Re: [PATCH v2 1/4] device: provide devm_krealloc_array() To: Greg KH Cc: Jonathan Cameron , Bartosz Golaszewski , Lars-Peter Clausen , Peter Meerwald-Stadler , Michal Simek , linux-iio , arm-soc , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 14, 2020 at 5:16 PM Greg KH wrote: > > On Sat, Nov 14, 2020 at 03:46:41PM +0000, Jonathan Cameron wrote: > > On Mon, 2 Nov 2020 15:22:25 +0100 > > Bartosz Golaszewski wrote: > > > > > From: Bartosz Golaszewski > > > > > > When allocating an array of elements, users should check for > > > multiplication overflow or preferably use one of the provided helpers > > > like: devm_kmalloc_array(). > > > > > > This provides devm_krealloc_array() for users who want to reallocate > > > managed arrays. > > > > > > Signed-off-by: Bartosz Golaszewski > > > > +CC Greg KH. > > > > As this is going into a very generic place I'd like a relevant ack. > > That file is a bit of a wild west for acks, but Greg seems most > > appropriate person. > > > > So Greg, any comments on this one? > > As there is only 1 user of this function in the patch series, you don't > save any extra code space here, I don't think this is worth it. > It's worth it in that the overflow check before allocation doesn't seem to belong in a driver IMO but is a general check that should live in common code. > We are seeing less and less gains from these new devm_* additions, and > only more confusion and problems with them. So perhaps don't add this? > I don't think it is needed. > I think you're referring to the discussion on devm_platform_ioremap_resource()? I would argue that consolidation of common operations in helpers is rarely a bad thing but it's a discussion for another thread. I'm not too attached to this patch - if you think this should be dropped then fine, but I don't see how the name devm_krealloc_array() can confuse anyone. Bartosz