From patchwork Mon Aug 5 18:24:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 816752 Delivered-To: patch@linaro.org Received: by 2002:adf:e00d:0:b0:367:895a:4699 with SMTP id s13csp1476541wrh; Mon, 5 Aug 2024 11:24:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhtULgygAB2zp1PGcNGf9pN8bwaxKkxLY14dtHf+cH9g5uLZIx/kmQE5wuemMMtzoRCFVTC8BmZA4W9Z+vS26z X-Google-Smtp-Source: AGHT+IHiK3aOLN8AFHhiaFNeDUi7k1o8RgHgHDiLULv0WDZu6LdC94LmRd02GlT62QMT95c3rx7A X-Received: by 2002:a05:620a:191b:b0:7a1:452f:9dad with SMTP id af79cd13be357-7a34eec9facmr1694061485a.4.1722882297974; Mon, 05 Aug 2024 11:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1722882297; cv=none; d=google.com; s=arc-20160816; b=QSLy0tq1eNdnW+W+gwwcQiZcCCbJf7KjSX4wKFcN8wMQvrX7RYxceDMwDtDSK+pFni ZVINudpUHq8A2CQ692CLU1m2rutfyBU+zlw15TDjUc2peV1MRXZMKUmvzzqps5YcIE1d 9zdmGumPmOdQ3cmgW48fVZpr2q1HTYohpVeZC/pYfmfm4AlMpRJz3txH61mpnjO7KYGe xrUA6Dze+ZTIfG+U3b/DPOqdLaKsGp0fuAOhlWRkPQ9xngUL8rwPCFL0fNKVZByDNcIZ 8WsVuG5Zebo4XQfXKL2Mc0IjJX1bhlYTwhM4xp9AUM7sA9hdGunMN+EeG6XtyS/T73Qb 71Jw== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=DTDKOs4NblzwzJ0N5OOLOoi8TReGq40cu1V5/g5GREQ=; fh=Smb1pgtxAIVrO2W2TdddpDAx7bbPCgHBelZXGhlE0QU=; b=A4K3MZupBOW03LKgQayaDZg0TCsenN3dfrVFznNdcujFi2vVfOX9e0FQfXa6zacMap VGWhYjsf7LlipdDuLeRXvOW1AMfa9SEz1njp9qUHIfof2UQoPO9KL+uyreoU53B+Wqy4 D8qoNHCgogNPXt5yikZCOHz+Z1rxFUXds82S7IQM7NqM1+xkwVyW2dPuMqVR9mTkwXiJ Kw4TYtKfsTcb6GqMuv2Xq0URRHDYVjW33yftSvwJDkQrwJIDQ31V8pLx4XAo+4V/jS0V ymm7J6BOJchH/fuYMwL0zblKlhEj9yKp92gmiOVytXIANriKAK7VyB00Hn2WMDB4XoeX 0yig==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZY9LvPke; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7a34f78b504si1067136985a.624.2024.08.05.11.24.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Aug 2024 11:24:57 -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=ZY9LvPke; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sb2Ng-0000w4-DA; Mon, 05 Aug 2024 14:24:28 -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 1sb2Ne-0000pp-Sh for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:24:26 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sb2Nc-0000d1-VS for qemu-devel@nongnu.org; Mon, 05 Aug 2024 14:24:26 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5a156556fb4so14797338a12.3 for ; Mon, 05 Aug 2024 11:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1722882263; x=1723487063; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DTDKOs4NblzwzJ0N5OOLOoi8TReGq40cu1V5/g5GREQ=; b=ZY9LvPke0ecpx6BcKaOkUSRpyYgFZpAMF2kM5ndqt3bDQmUnWzOwGqqDZnw2DyKPqZ 8ueg8jqqE3CxpH5iGiR8AzKWh3k5Tf7l4pUnIDBccVh9e7Nd28yGsKUC5NjirRkLN4Fp 1NDQdWSbuPJLdQNFwrLcQ3g6BIQ8oFV4DYAaV4ZUtzYNfFNK75/t2EBaofiHMiSXGXQJ m/CcggF1IuOgOWdhKCXsIpKH7dKAKgLXJ1cDtZsLNSEGnw6uW4O3HDz8OLEPET67ZNEY Z1RIiNPghD4oyz1zJDxyjKAuDKua4nu7QOBo71wHwXyDeD401fT21F6inw91Ko7tq7L+ P2Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722882263; x=1723487063; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DTDKOs4NblzwzJ0N5OOLOoi8TReGq40cu1V5/g5GREQ=; b=vPC/sxZm3bI7jyg6HwqcTqZSeyPesFTOHTVV1S4YV62njo8vMMYR8RnzGs3l56sTiA CWCVIHstdEuPbMkyzNEv7i1+1eGH2qt5AcuB0SN4Kr0JWrLbqyOB9wY3bQhY3NlIHorn G6El7zPMu44XgXgzf/91sOpO4UjJ41UUwSrjGWsBzsGx0xU1zfDqXGf1vy095Q17lGDn lohWfxn33Cn+dn8cAztrWTEsv1u+EwTFvfyvuzQY76EQUXE4PwUxvyFebmxA7ytfRNJ2 EZ8Hiub9Mpo+/s7/R1Z2Hnqwm/32IEL6ql+htcoHfFu1yT7jX2zopYaRlVWB+eqLgx6z m5Rw== X-Gm-Message-State: AOJu0YwTCTipkZZA19btAGa7xHwFVW9EpyZKpmBXX4KYzC1kX6PnnuhO vCoHAy9+RrYHAiiJ3qGlVnyY2flSinSTLJGRjsd+PJAeRbEUb2lvU9AL4sUBuvjmtlhLZ5azP6H N X-Received: by 2002:a17:907:9492:b0:a7d:3ce8:131c with SMTP id a640c23a62f3a-a7dc50fd837mr735801566b.62.1722882262744; Mon, 05 Aug 2024 11:24:22 -0700 (PDT) Received: from m1x-phil.lan (cor91-h02-176-184-30-206.dsl.sta.abo.bbox.fr. [176.184.30.206]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9c12ff1sm478583666b.58.2024.08.05.11.24.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 05 Aug 2024 11:24:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: John Snow , qemu-block@nongnu.org, Peter Maydell , Kevin Wolf , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.1 v2] hw/ide/pci.c: Remove dead code from bmdma_prepare_buf() Date: Mon, 5 Aug 2024 20:24:19 +0200 Message-ID: <20240805182419.22239-1-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=philmd@linaro.org; helo=mail-ed1-x52b.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=unavailable 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 From: Peter Maydell Coverity notes that the code at the end of the loop in bmdma_prepare_buf() is unreachable. This is because in commit 9fbf0fa81fca8f527 ("ide: remove hardcoded 2GiB transactional limit") we removed the only codepath in the loop which could "break" out of it, but didn't notice that this meant we should also remove the code at the end of the loop. Remove the dead code. Resolves: Coverity CID 1547772 Signed-off-by: Peter Maydell Reviewed-by: Kevin Wolf Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- v2: Break and return once at EOF --- hw/ide/pci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 4675d079a1..a008fe7316 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -237,7 +237,7 @@ static int32_t bmdma_prepare_buf(const IDEDMA *dma, int32_t limit) /* end of table (with a fail safe of one page) */ if (bm->cur_prd_last || (bm->cur_addr - bm->addr) >= BMDMA_PAGE_SIZE) { - return s->sg.size; + break; } pci_dma_read(pci_dev, bm->cur_addr, &prd, 8); bm->cur_addr += 8; @@ -266,10 +266,7 @@ static int32_t bmdma_prepare_buf(const IDEDMA *dma, int32_t limit) s->io_buffer_size += l; } } - - qemu_sglist_destroy(&s->sg); - s->io_buffer_size = 0; - return -1; + return s->sg.size; } /* return 0 if buffer completed */