Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7541954rwd; Tue, 20 Jun 2023 02:44:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5RO97hRFdxpH17/13OmQ1B1zf7LsiVKUW+kMhI+/8FpYpVMI2NUpjuh+tKoU5SyDE0IwJ1 X-Received: by 2002:ad4:5be4:0:b0:623:4ca9:5b24 with SMTP id k4-20020ad45be4000000b006234ca95b24mr14284124qvc.12.1687254291627; Tue, 20 Jun 2023 02:44:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687254291; cv=none; d=google.com; s=arc-20160816; b=C/XVN7r2wA19CI5VN3Kc8SpFIEVYAaxfHAZTnVNIxNkyImDGzEJI6NhPWoz0Oj04Ym Q6fsJYcI+9WqfLEcAyz+jJ5nedSmYgxYtELSN2Zvq6jWpu0GmRTu2TfvZqJdB0yT1m2h /RwhSD6a6VGvPHTC5PEo96uxHNM7K8QSYN/tv+7cfoKcHU6o3QEZ/XI9GCsr5uM99FDW N9367OrQIVaifmco4Lue3PUYmIE2hDo3dEB4hCEVus/34tFUmR0VXQZsPJyj0WtpnlG9 Y3dZJgCL/GvGHRXEouYWvYcuvmpFOHKkcvXpPqV4r8Yt2efjmd4N+OEzsSDzSLms0JOE LsrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gVkM6+W1qmkn+4ra3lOj0Y7+i50VvTERm8Ts7tKxv90=; b=l+Myl8sZ8M/wC8n4JLpxs5e+IIUkUJ4KXBMJenRUoUZQWKxsmi8f7hDmLrGwGs7AXo fUpsxh6QZa95hqSpG6uM3+W4Zk2r2zYhhgOpeMcsAM8uX8SDtxHGBl6TegvrR7Ag99s8 AZDCPT+GLMo/3HMAUA8RDeYPyLaP/wBMEHkaMYl9x+x2tATBydsk5LL4XkllgGPj3GKN Ysxm618iFR+jNtTobKNljr+Mnvfouw4cEL0OEMiqJGJxW9XSCOaFkPZPjK86ulMUT60q UGrHShETNlNfKMhow/RZZRG7IYeMMiJGKIHDZzJilAyeyz3V76p/P4k8FWFAveh8QYPq KYxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kBn50GNB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q65-20020a632a44000000b00553851380besi1389456pgq.397.2023.06.20.02.44.37; Tue, 20 Jun 2023 02:44:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kBn50GNB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbjFTJYh (ORCPT + 99 others); Tue, 20 Jun 2023 05:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbjFTJYf (ORCPT ); Tue, 20 Jun 2023 05:24:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE8A6D1 for ; Tue, 20 Jun 2023 02:24:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4AC5861034 for ; Tue, 20 Jun 2023 09:24:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F120C433C0; Tue, 20 Jun 2023 09:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1687253073; bh=9N6EIJ38Xk+9+ewliRVUBI3DulDbnvVkXDhlrDbSKFI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kBn50GNBszeGoHi+Y44dG5B218OG3oc1Ieqb86NZDmEckz0UkrdXEq1YD16W0OeZe ocWl4ntMap/XL6+QUsZagw6La/LVOW/Vihvm01pIjp748HGGWXYmd8H9qfmbIIXmm4 RGa6oWj2VJi69vCgQLzSrABBIcQIxWl8GH8oUq70= Date: Tue, 20 Jun 2023 11:24:30 +0200 From: Greg Kroah-Hartman To: Prathu Baronia Cc: "Fabio M. De Francesco" , Khadija Kamran , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, dan.carpenter@linaro.org, error27@gmail.com, lkp@intel.com, oe-kbuild-all@lists.linux.dev, oe-kbuild@lists.linux.dev Subject: Re: [PATCH v6 1/2] axis-fifo: use devm_kasprintf() for allocating formatted strings Message-ID: <2023062015-snipping-wanted-276b@gregkh> References: <20230619162246.33007-1-prathubaronia2011@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230619162246.33007-1-prathubaronia2011@gmail.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 19, 2023 at 09:52:44PM +0530, Prathu Baronia wrote: > In various places, string buffers of a fixed size are allocated, and > filled using snprintf() with the same fixed size, which is error-prone. > > Replace this by calling devm_kasprintf() instead, which always uses the > appropriate size. > > Signed-off-by: Prathu Baronia > --- > V5 -> V6: Split into api change and name change commits > V4 -> V5: Remove the dev_info() and use a unique identifier for dev name > V3 -> V4: Split into warning fixing and cleanup commits > V2 -> V3: Fix smatch warnings from kernel test robot > V1 -> V2: Split into logical commits and fix commit message > > drivers/staging/axis-fifo/axis-fifo.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c > index 7a21f2423204..7d8da9ce2db8 100644 > --- a/drivers/staging/axis-fifo/axis-fifo.c > +++ b/drivers/staging/axis-fifo/axis-fifo.c > @@ -816,10 +816,6 @@ static int axis_fifo_probe(struct platform_device *pdev) > * ---------------------------- > */ > > - device_name = devm_kzalloc(dev, 32, GFP_KERNEL); > - if (!device_name) > - return -ENOMEM; > - > /* allocate device wrapper memory */ > fifo = devm_kzalloc(dev, sizeof(*fifo), GFP_KERNEL); > if (!fifo) > @@ -857,7 +853,11 @@ static int axis_fifo_probe(struct platform_device *pdev) > dev_dbg(fifo->dt_device, "remapped memory to 0x%p\n", fifo->base_addr); > > /* create unique device name */ > - snprintf(device_name, 32, "%s_%pa", DRIVER_NAME, &r_mem->start); > + device_name = devm_kasprintf(dev, GFP_KERNEL, "%s_%p", DRIVER_NAME, &r_mem->start); As Dan points out, you are changing the name here :(