Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp84lqj; Wed, 10 Apr 2024 01:36:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUcrdFiWWeU67EThk3V4ry18fWFOEN0QVSEOoSUNNzKJj0rL9CbsTe52hhpwU+/SkFLS0n/LKfBOPSCZ0NdN2WRU5vgqV1lbKY91uby1g== X-Google-Smtp-Source: AGHT+IHefYhdjTEccS7N0+07mA+afl0ASs1JoM0ZZWF03lM1+M3IhJ/63r2s6d+yNXTL+ddoZ4fI X-Received: by 2002:a05:6214:500c:b0:690:c7a5:1dc9 with SMTP id jo12-20020a056214500c00b00690c7a51dc9mr2029226qvb.42.1712738207855; Wed, 10 Apr 2024 01:36:47 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id cx5-20020a056214188500b006994960955bsi10303297qvb.596.2024.04.10.01.36.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 01:36:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=luiGW5o5; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-138175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138175-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C5B2B1C20FDF for ; Wed, 10 Apr 2024 08:36:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 992921552E8; Wed, 10 Apr 2024 08:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="luiGW5o5" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28607146D66 for ; Wed, 10 Apr 2024 08:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712738184; cv=none; b=pxypkoTp+HIgfjqxiG1UES+AW2gu41PAfp/1ul+wY+B81y1UxMnSrTdF+MVb/euvzgQTgMMSp0DGUVGTVbJBswoMHeYIuUeBw/CFnpQLVXKRfYUvDfin/KlhfOrAMLDqVuDOW2wmRy4OpNQj6XbV+rbywkSgxBHuP8vwBeddpn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712738184; c=relaxed/simple; bh=CHdAxLoBOGL9I5p8Ew8usJ4IwvLH18ZThFBDeQwsKf4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=u4KUmDNot4kh9MGvmn7Qn0XIG5szKxz4DbZhzhzYjnVSes9kmdzcSXLOleqOE+0o6UNq/ifZmC4kqR6Wd4Hz4Qx6+vfBJSFApRqfLOyGmRGuCRianK24NJeR4wQPbos9viT3g/t7uvL5C0ty+GBYqmFYmb+578AV6BY0y+lswfs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=luiGW5o5; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-516db2214e6so5366996e87.1 for ; Wed, 10 Apr 2024 01:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1712738180; x=1713342980; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=j9442A62TET00hjBhezvrYLKwHX+oM+EzqcfF+cyAB4=; b=luiGW5o5J9NhDfsYt/Wxk8bc46+t6JG4OSiMlwDj8ptz8BuqRq7/Dn3DbH2B7tPlFi kGXKlUE4ZzSDetkQvr+ZZgoAvlwkfhdI13bLjK/AU1VMWrhvtxbdBh1NDe6ryMXeOQmx v+gN6n5UFbmQT+9VGklXqKbFjQjysncrRJWnHIlb8VAkGnroOx6rkfiBM16C4QcE21mG U/UcAxxw1sDGMrJShkNBI6V/jbo8PoaeYXOSSEuoUvBuxgUqMfh4YlHMPssRgEzRLi4W u1aF4PfCz/ES/xncEyNL6C+3PM0DBf3IbYQjRn4Chy3bfYeEJaK1aw0QM9PCrb2igIrT 2X3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712738180; x=1713342980; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j9442A62TET00hjBhezvrYLKwHX+oM+EzqcfF+cyAB4=; b=j/6YzGkHUL55L2H6fiM7N/Ib/ZiLuJfjvsNOrhlKLM/IaD6dWEaJhr8BIv3SMtm0EM /MQzeCSIBhYcNZsy57rvlk3NKZwIxgl4Gg6SG4DDmdiTWbWO6ygz6nDR/RljSoqAecpT RKCwNEkK9kEim8uOIjNtx2cns/wYdA2yS81LVC4KFpluQJ620Doi7GIf5A21FhuyGipJ lqcLmSpTELeduMS4Pr5LdhMr2H5l7NOeXMy8iJBNwyR1FfIxbeVmdnkiITeqokd2imNU 6x8YOD00BsEAkCLcMU1yu8Y9CTxSRqSqgo6Yp0+oUq77zFE1SXh3qIE8IGyncVHl74SL TeRg== X-Forwarded-Encrypted: i=1; AJvYcCUksiS3gvpBqxXxh7bv55DCG8MclUETv3sbvE7I3O/UGkdxXtzVe8j8E3G/MeHTirQb/X/nngG+kB01ixzuKAh1+gDcunPaMhWXKfrR X-Gm-Message-State: AOJu0YyIetcht8l4Wc63MzGmSOxhOjTCQDCEthCrF7uzvPJAHWP4FDSR 56SPdUvDylfT8gM5sko8JULwF3PljPd0LO2br4x7MAhUeNRRTKnLCzf9p8al84I= X-Received: by 2002:ac2:54a4:0:b0:516:c11a:4dbc with SMTP id w4-20020ac254a4000000b00516c11a4dbcmr981724lfk.22.1712738180088; Wed, 10 Apr 2024 01:36:20 -0700 (PDT) Received: from [192.168.1.70] ([84.102.31.74]) by smtp.gmail.com with ESMTPSA id iv6-20020a05600c548600b00417bc4820acsm528157wmb.0.2024.04.10.01.36.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Apr 2024 01:36:19 -0700 (PDT) Message-ID: <6f356fec-4384-4367-8812-a18b71156116@baylibre.com> Date: Wed, 10 Apr 2024 10:36:16 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v8 2/3] net: ethernet: ti: Add desc_infos member to struct k3_cppi_desc_pool To: Jakub Kicinski Cc: "David S. Miller" , Eric Dumazet , Paolo Abeni , Russell King , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Simon Horman , Andrew Lunn , Ratheesh Kannoth , Naveen Mamindlapalli , danishanwar@ti.com, yuehaibing@huawei.com, rogerq@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org References: <20240223-am65-cpsw-xdp-basic-v8-0-f3421b58da09@baylibre.com> <20240223-am65-cpsw-xdp-basic-v8-2-f3421b58da09@baylibre.com> <20240409173948.66abe6fa@kernel.org> Content-Language: en-US From: Julien Panis In-Reply-To: <20240409173948.66abe6fa@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 4/10/24 02:39, Jakub Kicinski wrote: > On Mon, 08 Apr 2024 11:38:03 +0200 Julien Panis wrote: >> goto gen_pool_create_fail; >> } >> >> + pool->desc_infos = kcalloc(pool->num_desc, >> + sizeof(*pool->desc_infos), GFP_KERNEL); >> + if (!pool->desc_infos) { >> + ret = -ENOMEM; >> + dev_err(pool->dev, >> + "pool descriptor infos alloc failed %d\n", ret); > Please don't add errors on mem alloc failures. They just bloat the > kernel, there will be a rather large OOM splat in the logs if GFP_KERNEL > allocation fails. > >> + kfree_const(pool_name); >> + goto gen_pool_desc_infos_alloc_fail; >> + } >> + >> pool->gen_pool->name = pool_name; > If you add the new allocation after this line, I think you wouldn't > have to free pool_name under the if () explicitly. Hello Jakub, Thanks for these suggestions, I'll implement them in next version. Also, about mem alloc failures, shouldn't we free 'pool' on kstrdup_const() error at the beginning of k3_cppi_desc_pool_create_name() ? I mean, it's not visible in my patch but I now wonder if this was done properly even before I modify the file. Currently, we have:     pool_name = kstrdup_const(...)     if (!pool_name)         return ERR_PTR(ret); Shouldnt we have instead:     pool_name = kstrdup_const(...)     if (!pool_name)         goto gen_pool_create_fail; (maybe label to be renamed) ..so that 'pool' can be freed before returning error. Julien