From patchwork Mon Mar 25 12:35:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 782318 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp1146959wrt; Mon, 25 Mar 2024 05:37:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU001fLxnyO7AEkABM4lukOWCO+mw9kA2toMBO1aOqWX9CZ3Tt+54GfcWE3k0tS6m5ByAvK4McPwgx4Wl7QM/ws X-Google-Smtp-Source: AGHT+IHKeJrMb9bXYLR3rhzYbvKyM/pnJThLmdZMN9ZyZQzsYDjOuVcTdN6XKrvydXXVIo+cIEW3 X-Received: by 2002:a05:6808:128f:b0:3c3:865b:5311 with SMTP id a15-20020a056808128f00b003c3865b5311mr10038099oiw.48.1711370254880; Mon, 25 Mar 2024 05:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711370254; cv=none; d=google.com; s=arc-20160816; b=ZJXgY/+Axaynjwak44a81RxHTNDfk5aauHzuRtC0qSldisvnjN3i07Y8OW2YOfj4B2 gQulnbx8Gh6WSoQgLNUN0G3FyJam2KTvwITrrikvZ8NU30MsnoK/zbwdVngHxC4xvtZu IXQ/86sfM7pva/IRD/8XQwXdxuA4GBefYA2v6Gq4o6PLfJYqkRrATSvsQ3QqoV0G0V6f iNnwuWLJOYVjqd+PfEUp68rtaGdeE9qUYOJT4w0AJCu3TwwYWTZbB9yzTaS2K94P5/Rj X0D5xeZdNofBxyk0XLYfFNlqOGQZdLpbbHwIoL1kEGr4cym0j4UJxRPUHAdFojRiXf/A U7XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cPU63vtq7nGV4qBFhe6DUh4SCq/4JARPRKtq5Gn7vKA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=MRsp9XiUAqh9KaMZcPRHiP70doeOpi5vyYlsZkBrM2Ls9CO9mzNaI52ihttmMHYh0s frVpP/4d02PgGTeYKUPryTVfz14hgXslS6qvKA1ZRte9QMVan1Q85sfdPki+e87k9aHx gzLG0AD2/SX2xb6rOJx+ruBJ2IRSaiRhAtuQdo1vlnhwGToJc1lk/DavKh38JafRFKuf 7HXTTzfXTyreIsaAgLvoDk2b48N+XKt4UTdVfIHhc1DJN0Mypgt0+t16xa+P7GEOo5LP oJdIgWiXmHbk5R7JJ8KnsYHGFY4lFTpEaC0cGQ3ZtfOkb1veulCZJhPI7mkpwrlyAHQB Gz/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iW/PqS6V"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s2-20020a05622a018200b00430a20d021csi5235945qtw.601.2024.03.25.05.37.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2024 05:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iW/PqS6V"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rojYW-0002Ic-2q; Mon, 25 Mar 2024 08:36:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rojYU-0002Hs-5x for qemu-devel@nongnu.org; Mon, 25 Mar 2024 08:35:58 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rojYR-0005dW-QR for qemu-devel@nongnu.org; Mon, 25 Mar 2024 08:35:57 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4148c607f31so246485e9.0 for ; Mon, 25 Mar 2024 05:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711370154; x=1711974954; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cPU63vtq7nGV4qBFhe6DUh4SCq/4JARPRKtq5Gn7vKA=; b=iW/PqS6VPldOP78K54KmqaPGL9XCS7yBLaUn2k871mKn+j4dfIK8MJdL+X1sqUK1nF WhoLC4eYZUQILN9x2hQr1X0mBumWApK+yrJS5kEQuWu5Agg2oaxObJJvTCn1o9nW2/xU lu+a6sMPnbZibN7PtRKM+mPmGNgYGGbwgTlXjUggjKOrXUXTR+u46f6OC8WO0J02/A9i lgnK6WQ1rZs3Jw80M78sCWYJKdplMmYeoy+BVvLIw6Yywinj/r0lqxq13ngBdn7zh+oX noo+dtzvWMWC1DESe81wY4TOV09CGCrA9VCl1q5W6a9DQg10BTczpUmW4fPD8KDK3rzz IJ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711370154; x=1711974954; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cPU63vtq7nGV4qBFhe6DUh4SCq/4JARPRKtq5Gn7vKA=; b=CkP5Ufgy9sJxE0bnPLC9Hspir0MIkEliRd+9ZQYFJx8C9MPPQKyPMmaPLBcqaJFuzI YoHrTOthpUrDcv16Di0fqTGw1D/OphC6aveu3Lt96ik1H597def7sgKhLAG3KP6XzFfv p9ytKhQWKEdyerCVdNsdIMxYfOdSvUYwZ5cBt5RanTpgeEUICV3BhQRJSdlewBt3OfQz P0BViEyn4frXMf9Jbf1DpoUtCsQRs/aUUGdGCwqIWSUpv5VbmxK+RQAzmxf9YBS7vQ+R 9n8h/1cY+1lNPSUyazQGKhbseeqsrzBVKvcRAOCtOSfmSGeY83q3xBfAIFMhurIG1XKd sAaw== X-Gm-Message-State: AOJu0YzcTeJ9lupjZiNBiVvJfbVaidFe1Vf9r/3SmReCrnelvfIPcchm zgGauWAqsc16mPZ0Y5ORlaW6qJmADgD147iwj/kXehWlpEess4+qzgNviTcfamyb3KElfX5t72W e X-Received: by 2002:a05:600c:450c:b0:414:86a2:a43 with SMTP id t12-20020a05600c450c00b0041486a20a43mr2496920wmo.40.1711370154162; Mon, 25 Mar 2024 05:35:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id o19-20020a05600c339300b00414041032casm2303877wmp.1.2024.03.25.05.35.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 05:35:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 5/7] hw/nvram/mac_nvram: Report failure to write data Date: Mon, 25 Mar 2024 12:35:48 +0000 Message-Id: <20240325123550.1991693-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240325123550.1991693-1-peter.maydell@linaro.org> References: <20240325123550.1991693-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org There's no way for the macio_nvram device to report failure to write data, but we can at least report it to the user with error_report() as we do in other devices like xlnx-efuse. Spotted by Coverity. Resolves: Coverity CID 1507628 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Message-id: 20240312183810.557768-6-peter.maydell@linaro.org --- hw/nvram/mac_nvram.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c index 5f9d16fb3e3..59277fbc776 100644 --- a/hw/nvram/mac_nvram.c +++ b/hw/nvram/mac_nvram.c @@ -48,7 +48,10 @@ static void macio_nvram_writeb(void *opaque, hwaddr addr, trace_macio_nvram_write(addr, value); s->data[addr] = value; if (s->blk) { - blk_pwrite(s->blk, addr, 1, &s->data[addr], 0); + if (blk_pwrite(s->blk, addr, 1, &s->data[addr], 0) < 0) { + error_report("%s: write of NVRAM data to backing store failed", + blk_name(s->blk)); + } } }