Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2438183pxu; Sat, 28 Nov 2020 14:08:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkBnta31S4HcYqQbLaYVqi3zsb5hhArtOOo7SBB9Zdd2fPjDwGjkkZzDK3rfw9weypBgVq X-Received: by 2002:a17:906:7146:: with SMTP id z6mr7198237ejj.379.1606601309319; Sat, 28 Nov 2020 14:08:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606601309; cv=none; d=google.com; s=arc-20160816; b=AxyQqjLkMUC5g4YMSbQisiSt9zZV1XKD681Kc68zb6FNKnjXoLNjeDEiXQC/b2+I/C H0VHFAET2zY2DX+hdt4TqWxIxRx/nRf7cM8/hN57vw4pd8TFCQCspyT4PyMZyWdJMwWc QWDL6ZHgxLMn48rPYLx8bd2Jz2xp/uwxbu+Vml3+SIBfTET7H1dITC+2Fe5rbojP8oI1 CH83YRr8dD7suASaCVAXHWLkq8ZUmMovGtCJ/jKrhczCII9NL7zalUCYZJMquEd8gOQK Cnm0DaxgJ7xac1AZ+zq/O+gz0kPhGdELvryMCEhjnJHQMgX+dFI8gQOzEJKqLC0cCCL/ CBSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=P5C1C16THCGND/GzN7W5RlclktkNNwjdRt2dS6Xjt5U=; b=JtJT8ejV3bZIh/HICGRcKH1N+Aep23dECBq5Lghg658ryHn2bTLHSyjuTAvbtUxoBv bB5YdL9uCcvqmKtV+i9bISY0HWXZknd8ILwg3c4spgisxEDpdb9eq8F/HYpklqKzYNlN XdDR9wiwk/puIQB3Ow7LNKt6u60yuhTvWwXQf4FOF7T9PA7rrqucpoBnd4eJ2yS493Gm XUDg7v/RYfuxKTxOMcEgbx0gSZ6lqm+O4m54BQ2JwHGM/A/H6GJkHo3+3dCdSVQTUb83 T1O2CVxyV4QP66ErsedCMMootmyzzw9ffEj3qWcSbul6nMfFu9Y19gUb4PQ30+wkWkGc J6lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rnm00mPi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l5si7690682ejn.545.2020.11.28.14.08.06; Sat, 28 Nov 2020 14:08:29 -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=@kernel.org header.s=default header.b=Rnm00mPi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390008AbgK1Vub (ORCPT + 99 others); Sat, 28 Nov 2020 16:50:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:46046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732723AbgK1SQ4 (ORCPT ); Sat, 28 Nov 2020 13:16:56 -0500 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E766C246BC; Sat, 28 Nov 2020 16:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606579205; bh=tIKRhWls3YzYhbVGldXSkrWMmSCjQfXBQFEelNA1aWM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Rnm00mPizeX5NU8jciZzzV3em6AJ98QA8A5sG7mzGPah20ZRauHQ6W6P5B05yGeqh C0EyTSQjMtntaUCjrRaWhI+gtvOU07+MWkkFUSZnfCKj8G7zBaBgJ5wzIMA09DGmwi Cqi36nVkWJEB9aDGNWyJwHlTNVCU+5QquZH7qYBw= Date: Sat, 28 Nov 2020 16:00:00 +0000 From: Jonathan Cameron To: Bartosz Golaszewski Cc: Bartosz Golaszewski , Greg KH , Lars-Peter Clausen , Peter Meerwald-Stadler , Michal Simek , linux-iio , arm-soc , LKML Subject: Re: [PATCH v2 1/4] device: provide devm_krealloc_array() Message-ID: <20201128160000.5ac0ddc6@archlinux> In-Reply-To: References: <20201102142228.14949-1-brgl@bgdev.pl> <20201102142228.14949-2-brgl@bgdev.pl> <20201114154641.0258f4ee@archlinux> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Nov 2020 12:38:26 +0100 Bartosz Golaszewski wrote: > On Mon, Nov 16, 2020 at 11:18 AM Bartosz Golaszewski > wrote: > > > > 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. > > > > Greg: what's the final call on this? Reroll the series without this patch. If it turns out to be a good idea in the long run we can always bring it back, but for now it's blocking the rest of the series. Thanks, Jonathan > > Bartosz