Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2881147pxa; Mon, 17 Aug 2020 23:51:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxekBb7qCvObQ2QVVhsKnma53DtofkYo/vdAM3qQ2YmuDXRXz7kWyXRpgU3RB0Q2wsbcCcn X-Received: by 2002:a17:906:2e0a:: with SMTP id n10mr19548644eji.18.1597733486564; Mon, 17 Aug 2020 23:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597733486; cv=none; d=google.com; s=arc-20160816; b=x80RKNa5aFlRYRfagrA63CkC1Ipro3t7A2u1j07Cvta8HCo44mbZscix1+nsdrtuen ztwycXiSW7ejO9KXVr2BgrkyGPImmFjzo0imQcrqTGjLOwuZ9Yn8Wb7hHUc8CEqKrUK3 ruABjoJYeAPOyxMZR2aqQtiPLYsDbK+qInSR597+zfH5BkznEtKJ/srlxkD238EFbpLO /Abnljy60M60uSoEkeb9i/uWwnZQ8Lz95TcwudMCN2rpo8Z5LEnpfPimY3EskAVyVmDE jQJwAVgxgiayl6hXd834gS6VVIFEoR5SYDsvkcpn/Zv0rPMGXISxbPDsuB/eFCwHMC0b Ycrg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/+uWNSSjfEEPF2N6+QLJYLMqb6RlZPSAgW0i5xtsCXU=; b=Te0+ZTudVF2xl6EEJ+ceDpE8d5nLGXE3/jgsgSJXTEJ7I+mKEwrEPDUcsDFX5loAc9 U1WfRz4caqtGBXH97xVgQFgFOOeXIzcflWHOXmmWsKUs0lYSuFl5Xnvh/T6YriHkkG/S E5NpRONfTew+2c5KaAEtS0oZBBrv8b4O4+wkzO/nh3Vti99TdPJBTdTZjLPTDED2M+AJ 5Dl6mXJCngm/QSapIQnrYO/yZUb/pyDDw9ZK44QctCyM9GU2BZC+E3Sr6yjH8gtSyryo xnYEs2HtQ5oQICPdlli8zLfERZVNygry3ggNLaY+POffL0MgHy+ZH2gQrf/wY4SG9YuF rjlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sB3c89ME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si12588347edq.355.2020.08.17.23.51.03; Mon, 17 Aug 2020 23:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sB3c89ME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726570AbgHRGuA (ORCPT + 99 others); Tue, 18 Aug 2020 02:50:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbgHRGuA (ORCPT ); Tue, 18 Aug 2020 02:50:00 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9685C061389; Mon, 17 Aug 2020 23:49:59 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id cs12so9066551qvb.2; Mon, 17 Aug 2020 23:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/+uWNSSjfEEPF2N6+QLJYLMqb6RlZPSAgW0i5xtsCXU=; b=sB3c89MEcatZ8Ak0D/Sgweg8Ve+XXVDXoTkdk3tHQBZ3ChicLRVMetA8VSVC++k+tk 1ZUYNut7Be9Yb92g+i08jBItoEDckQHf83eu8WPD1oZUVTdAmWueX7QS83CxK2Q8BpCV MeyVbLXesN89IaosAoFeeAUNhShPQNHbQYBJnNAIikhSnYE2ub315/GfJi/oRnbhTGV3 L3pkj/hbNLIBIuH/lSdpqJJ5qFq911/5gft9CkXFCbKIkioJ5Kzp0eVs8tXjo2vqLGFI NoCzoJCynoyBUl8KIHtIqDWDw8aW/qxWb5ZXHJOppSnVvKEMQdCwrYIhHszj4JGvAVUx v7Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/+uWNSSjfEEPF2N6+QLJYLMqb6RlZPSAgW0i5xtsCXU=; b=r6j0ZJvGfAZBgxx+8QUNcLx7Ra3YMJt80/RrPNeNiYS82/a1LR4zZY7q0mTT1yViTY gluz7G+QZQ8QwUGS4YNEn+Wzz+C1W8MGMIgQE9W42Uf1UlEi/oB+TogMuzkjExEJQysX 1yBKcOq/H2XtAMUbrq5A5nm+bmkpCsrq0E9TwhUkgAhEupLJ9azs3uNt7raXjdAvTYDo fd2AQJTlHMq/49BkQHGSgq9yAF7ipLP83+FzaFKY5rliTG80e15Moe8F8M2OdaTROrms S9u0UKCY181+lo9bepdmJ+EKoAtS05S36gAxYjIDYXJlZ/pn54CGgM0Eu5tZYqCa2KFh K8ww== X-Gm-Message-State: AOAM531DFFTO1OeKQMKcjgjvs1YWpPaGXVjfOh5PduNlBkNuE0p31uQA CcKdPjuCmTlIN46X4M/XIvccHlGyICox8K2q X-Received: by 2002:ad4:4908:: with SMTP id bh8mr18260285qvb.218.1597733398996; Mon, 17 Aug 2020 23:49:58 -0700 (PDT) Received: from localhost.localdomain ([2604:1380:45d1:2600::1]) by smtp.gmail.com with ESMTPSA id d26sm23367032qtc.51.2020.08.17.23.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 23:49:58 -0700 (PDT) From: Nathan Chancellor To: Danil Kipnis , Jack Wang Cc: Jens Axboe , Guoqing Jiang , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , Brooke Basile Subject: [PATCH] block/rnbd: Ensure err is always initialized in process_rdma Date: Mon, 17 Aug 2020 23:49:25 -0700 Message-Id: <20200818064924.3984068-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang warns: drivers/block/rnbd/rnbd-srv.c:150:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (IS_ERR(bio)) { ^~~~~~~~~~~ drivers/block/rnbd/rnbd-srv.c:177:9: note: uninitialized use occurs here return err; ^~~ drivers/block/rnbd/rnbd-srv.c:150:2: note: remove the 'if' if its condition is always false if (IS_ERR(bio)) { ^~~~~~~~~~~~~~~~~~ drivers/block/rnbd/rnbd-srv.c:126:9: note: initialize the variable 'err' to silence this warning int err; ^ = 0 1 warning generated. err is indeed uninitialized when this statement is taken. Ensure that it is assigned the error value of bio before jumping to the error handling label. Fixes: 735d77d4fd28 ("rnbd: remove rnbd_dev_submit_io") Link: https://github.com/ClangBuiltLinux/linux/issues/1134 Reported-by: Brooke Basile Signed-off-by: Nathan Chancellor --- drivers/block/rnbd/rnbd-srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 0fb94843a495..1b71cb2a885d 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -148,7 +148,8 @@ static int process_rdma(struct rtrs_srv *sess, /* Generate bio with pages pointing to the rdma buffer */ bio = rnbd_bio_map_kern(data, sess_dev->rnbd_dev->ibd_bio_set, datalen, GFP_KERNEL); if (IS_ERR(bio)) { - rnbd_srv_err(sess_dev, "Failed to generate bio, err: %ld\n", PTR_ERR(bio)); + err = PTR_ERR(bio); + rnbd_srv_err(sess_dev, "Failed to generate bio, err: %ld\n", err); goto sess_dev_put; } -- 2.28.0