Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1455744rdb; Tue, 30 Jan 2024 21:30:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNnQSnKFSO2yyRa5G2+eVEZIk0RkojfulXF3mX2loz13Eltx4ucXe6n578rdWluqNPIFKm X-Received: by 2002:a17:907:38b:b0:a35:aced:a3d8 with SMTP id ss11-20020a170907038b00b00a35aceda3d8mr295452ejb.34.1706679010080; Tue, 30 Jan 2024 21:30:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706679010; cv=pass; d=google.com; s=arc-20160816; b=NJqmyxjS2uRN4r1Wzzso7ajgb5LZmeohbWmVmO7iMMx52g0oYjdvEVbfnaxch3N/NB p1UqVUHg6ZjakCNwae9cI5z/qSDqwwQf7ALBLcYrJblLcqZlISlYdJDbmQ8B00CRyp6T mzX1iYKHfx681fy4lihW8yTf+3onRpGjZZFjH2iw1e6B7GUHdPRy3Yp8U8sRF8ps+vHK lE7QDlNmEMbzps4LiQwItOd/WvRigoFoqEMhaBCeTSPBIS2aNYKIn5QrO3XGV4rTFzs4 VrhJsjdMPwnmp8MwAvp1ZUk/C6CgPAyRDmuzIrvMJ5O7qM2uwGKJRBay9BFHfpfPa8sI +7Qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=d7k+zBGEMF6YpOa1LkQnutMjUdWxJu8MXlfVrHzAPlc=; fh=nIRHTxRfskSruP8bGp7REVivz6tWncE/I7cGOvIC8wk=; b=Z6WQwbpngM/I8MfF3p07tJ7bNMzgu48DQxkc2u1DxJkkmoQaOnIRxM4xu6HNO9D2Ho LoWB588H7Aur9KPxchoTaCOxWdppjDtufL6AFEaCcq8OzKSg2xue8oWAEkwFVHr6/qif vYZa/vBW0PLQTSQwDDNiaINIaWMi14cxgo1clwxYCWDzjmq6zWI9Saw7wm2maMbSZrU0 yh3xzsTM1sMj8Own0gNGQdjqWwwPgXnqJKgo2XkLTuu1l80iL5xkaR6c/bX1YEFV/g0F PRnbbk+DYRcgSNfrs33MhX+1fom0q286RDJJhpStXdf5p4nNqX83YOv8Nt9nWzeK40dg qVOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=milecki.pl); spf=pass (google.com: domain of linux-kernel+bounces-45771-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45771-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCU6DOCMe8OXtkBvvqOYOFblVQTS3us1z048nBJsF7mB/uuvtwPymq4esaiwmxUKVauMtoQUvU0Zul6M44yGYwtPoj/MljJhB0YTvI7qWg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f21-20020a170906495500b00a34992cf026si5234868ejt.757.2024.01.30.21.30.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 21:30:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45771-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=milecki.pl); spf=pass (google.com: domain of linux-kernel+bounces-45771-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45771-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A83821F22AFA for ; Wed, 31 Jan 2024 05:30:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 610AD3D97D; Wed, 31 Jan 2024 05:30:02 +0000 (UTC) Received: from 20.mo581.mail-out.ovh.net (20.mo581.mail-out.ovh.net [46.105.49.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73BFB3D550 for ; Wed, 31 Jan 2024 05:29:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.105.49.208 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706679001; cv=none; b=UQRkudfCXlkkAbJ9iYOrByVEr4bBbYl+Cc3kfOUCxbt7rGHZuibK1wk+lOVF8ojHS4xpBueADTuKpnxVpF/jEguP7Qs+mwi+Y2x0DvOAKxJeXQl/fPPFRiWT1oZIiwmObK7KfO0b3Bj40pnLDoMkCIrSi1o1yeCbMsykLpY9ZLc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706679001; c=relaxed/simple; bh=/xxCLaYufNFbE2C9ZKm3WjJqcCufD+y6RDZet2SDfiI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=clj6SA9isKJzJMNpA64phdzWS3XlqPR7f7idicgLaAmGgUI1N8HQnqOi4GZKhZOYerESqYdj7KLZalhwV49jfTq2h6pOKhqzA95AEP0oTEAqcz3mwrlTq/1zGVx+vkd6b4y0d3jaW/S+KBfQGFkQ1T2Whdv7a4+3vEkGFe5Kbo8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=milecki.pl; spf=pass smtp.mailfrom=milecki.pl; arc=none smtp.client-ip=46.105.49.208 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=milecki.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=milecki.pl Received: from director3.ghost.mail-out.ovh.net (unknown [10.109.176.72]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 88AA027AA0 for ; Tue, 30 Jan 2024 21:10:53 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-4ps8g (unknown [10.110.113.119]) by director3.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C79CE1FE0B; Tue, 30 Jan 2024 21:10:52 +0000 (UTC) Received: from milecki.pl ([37.59.142.95]) by ghost-submission-6684bf9d7b-4ps8g with ESMTPSA id vxk6K9xluWV91gEAOrHdXw (envelope-from ); Tue, 30 Jan 2024 21:10:52 +0000 Authentication-Results:garm.ovh; auth=pass (GARM-95G001b2353eda-26b4-4e23-bfca-ffff08e380ec, 247E30736BCEA492ABCB1DC3D73798F611B73BDA) smtp.auth=rafal@milecki.pl X-OVh-ClientIp:31.11.218.106 Message-ID: <3292ae5e-07e2-49df-81f7-74e1b5e8dfb3@milecki.pl> Date: Tue, 30 Jan 2024 22:10:50 +0100 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 v2] nvmem: u-boot-env: improve error checking To: Nick Spooner , "srinivas.kandagatla@linaro.org" , Dan Carpenter Cc: Evan Burgess , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" References: Content-Language: en-US From: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Ovh-Tracer-Id: 7340022971110828923 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrfedtjedgjeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeftrghfrghlucfoihhlvggtkhhiuceorhgrfhgrlhesmhhilhgvtghkihdrphhlqeenucggtffrrghtthgvrhhnpeegkedvgfelueetledugffhuddvffejkefhheetfeevgfegleehleduueeivdeujeenucfkphepuddvjedrtddrtddruddpfedurdduuddrvddukedruddtiedpfeejrdehledrudegvddrleehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeorhgrfhgrlhesmhhilhgvtghkihdrphhlqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekuddpmhhouggvpehsmhhtphhouhht On 30.01.2024 20:42, Nick Spooner wrote: > Coverity scan reported CID 1575482: error handling issues; this patch > addresses this by adding error handling to u_boot_env_add_cells. I'd appreciate description why do we need this change other than addressing some Coverity report. Should a single nvmem_add_one_cell() failure result in not registering NVMEM device at all? Why? > Signed-off-by: Nick Spooner > --- > v2: > Fix whitespace issues in previous version > > drivers/nvmem/u-boot-env.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c > index befbab156cda..c15de5f7fd99 100644 > --- a/drivers/nvmem/u-boot-env.c > +++ b/drivers/nvmem/u-boot-env.c > @@ -95,6 +95,7 @@ static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, > struct device *dev = priv->dev; > char *data = buf + data_offset; > char *var, *value, *eq; > + int rval; > > for (var = data; > var < data + data_len && *var; > @@ -119,7 +120,9 @@ static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf, > info.read_post_process = u_boot_env_read_post_process_ethaddr; > } > > - nvmem_add_one_cell(nvmem, &info); > + rval = nvmem_add_one_cell(nvmem, &info); > + if (rval) > + return rval; > } > > return 0; > -- > 2.34.1