Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1877967ybn; Thu, 26 Sep 2019 03:38:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1tbSVlUe3UdApxew96ZglQfhCuIxdfZCLLiA+AQS+5xxSGMSxxBhopAmjv+MQ6ylsDuYd X-Received: by 2002:a50:91d0:: with SMTP id h16mr2875096eda.152.1569494310059; Thu, 26 Sep 2019 03:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569494310; cv=none; d=google.com; s=arc-20160816; b=aKduFSGvUxeObTgTeq7kixXQ8mJpCRXiexKRhqG4HSB1Txn/enphoQmgSNIvX3iseX xNjCE30Kw4vM/B49PnTj24wrny9jSpVBZzH8rh8LF4URky7l9TxRPY0vVXR6jLBadtWf GLoxbXZpH0kp/yyq497ZJ/AHfMgPYt8ZU0SD5o+GiiHC5frWCjX8EsSGPokeglc3SM/a RP3iVFz/7LGS7nwunAfChrp7iNTxE1wvy1a4PVbZYBcA4T7XBhs06FFYEfoolA6vljmu fUzC++7KvWhIZ4ujxh+w0fHIMikF/TtBPLsGDKISEM0yyO35pJxTQ78RABaIRNG9askF Wbxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=E4eI7Jik40069/c+QEXtjqvQmZEgJbgkNRDHc9TMnHM=; b=UwGp6f31LP6xxh0gx/xfw6M3USp9XxmJvYVHNUU2C+b5Z+2zO66xUDKerp0uHoea6J Tj/UL/P2Ovw7BXgxP01x1SBkFFi7Uk/A5mr+ffnKZj48NAVVmnUZSX3IzZ7elrDIIoxq WHUGF9A2lXbdqi6yxlSU5pc47qHYW54h8NFe9+k+io7eXwMXDevH1xl5g1Oa2lsJlKJ1 kdXCFBLf12hhngegXauzZiYHgaCdjIxi7t69KH/IWJyjr2rN0vvllFesA9KUYL+OOIpk yNM+sz9E+H+PuUU+4OXszmGpEnlR2G4eHLPAqcXCVmRQDmn4c+xkCnM9ifo4LKinSjA4 VoCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d26si1118906eda.190.2019.09.26.03.38.07; Thu, 26 Sep 2019 03:38:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729197AbfIZJuP (ORCPT + 99 others); Thu, 26 Sep 2019 05:50:15 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:49450 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725980AbfIZJuP (ORCPT ); Thu, 26 Sep 2019 05:50:15 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iDQPc-0005BW-TY; Thu, 26 Sep 2019 09:50:12 +0000 From: Colin King To: Jens Axboe , Alexander Viro , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] io_uring: ensure variable ret is initialized to zero Date: Thu, 26 Sep 2019 10:50:12 +0100 Message-Id: <20190926095012.31826-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King In the case where sig is NULL the error variable ret is not initialized and may contain a garbage value on the final checks to see if ret is -ERESTARTSYS. Best to initialize ret to zero before the do loop to ensure the ret does not accidentially contain -ERESTARTSYS before the loop. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: dd671c79e40b ("io_uring: make CQ ring wakeups be more efficient") Signed-off-by: Colin Ian King --- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index 7b5710e3a18c..aa8ac557493c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2835,6 +2835,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, return ret; } + ret = 0; iowq.nr_timeouts = atomic_read(&ctx->cq_timeouts); do { prepare_to_wait_exclusive(&ctx->wait, &iowq.wq, -- 2.20.1