Message ID | 20230406074607.3637097-1-harshit.m.mogalapalli@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp849820vqo; Thu, 6 Apr 2023 01:00:39 -0700 (PDT) X-Google-Smtp-Source: AKy350bQ+8KfGhtS9y+zfW+vf1rSjdfHEBs4ziRDJJFJKJOuTcxcAel6EhtDKh4QWM3kvs7aOs+t X-Received: by 2002:a17:906:94d7:b0:92b:846d:8928 with SMTP id d23-20020a17090694d700b0092b846d8928mr5324599ejy.65.1680768039433; Thu, 06 Apr 2023 01:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680768039; cv=none; d=google.com; s=arc-20160816; b=iInCgQSGuPTayt9fP+i9xGwOKqbGARbluhq5Wdvrf2OMhQy7W6Yl6De+OlMxdwAyv8 jtxJzI8UZNy3NhCQ7id2NyAwRw6HpJhlFJcGAs6L5JF3WSlBObML966RTY8A/RoydaQ9 HBlSUXoLAPEsjGJEIzaAN/yp/04bmo+uXcUiNsdOAPu5cf/uTPhcznRdeTw5h2p4Kjra yicrQ/xwJrrG6lys34F5i7RiwZVhl5A3S2BUKdGUKJIKfVZ5xJ+3cqkT8eEYGN4eOWay PLwPs/W0WT6s9rU/dnYgF8PgnjJXEGI+Wv3sGqM241IMhOnwG8//l1nvir/yCM78hoEz a+XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=IyEmgHIUX6mQHOFxo3TU81FvsDpncR3Vt/+XHIZJcc0=; b=GRmfxftUsS/lXEdy+Px25or0enwRS+f6xNhT4NJ70b48F+NxhJ6k2hvpKfQfb/q2ix Zf3cSyQqEaIZcoAXUd3N+TY5imizxEaKJemAdSlxcQhhK8xRqFFBvzVz0YnaNNfrR7eY oTVmpYTq2qmIgChT9lfzbB0tlZoP8YA2Rdv2jLotgH3fU2UttwCMwEnp34191phf8K+I H95DnTAemJXN2+I1fL7ie+ouFUXZo/OqQxJs3fq716n8xD4nvyZbuPGjwX29+/gn/nPQ ie46m8htzL4IMPaC6lSQlbr5qiC82mTg90FagzyR/9LzHTpSP6dZ+J4GId24brf0EQTf iNPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@oracle.com header.s=corp-2022-7-12 header.b=jLyAe9fM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a170906601500b00934f9a52925si733672ejj.76.2023.04.06.01.00.15; Thu, 06 Apr 2023 01:00:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@oracle.com header.s=corp-2022-7-12 header.b=jLyAe9fM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234958AbjDFHqe (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Thu, 6 Apr 2023 03:46:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234878AbjDFHqS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Apr 2023 03:46:18 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C701B0; Thu, 6 Apr 2023 00:46:14 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3366wSKC013882; Thu, 6 Apr 2023 07:46:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2022-7-12; bh=IyEmgHIUX6mQHOFxo3TU81FvsDpncR3Vt/+XHIZJcc0=; b=jLyAe9fMXWMM45769fZXZ682Z+QRYXNNcFALPa/KaJumEYelxQ1UeoYi9NbMFhLRgHK5 npGF+5V/FJfshS4kP40xzkE6+mWhdQ1kxQuJsDP8S40QYCazTlw7kGfRDs1tZ/6pC5CH SRIXV09yFfSPaudfrMWOQDpsUlrIvbmIGk6YzXEcViW0t+JRyivQUf35iV9LPTEwJBaE pJ2qNVYcQ4/cG8afjA/2Qg8uIW8MaFy37D14VRYCgA1lkhCbkuhehIu9cROYdhawvyLo rS0bMJzr8bmSwTdUdAPS+d9cgDmHvKHZXYXvQ/cD24Pnof3E6hC4B6rsmrvbHlTNaUXz Ow== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ppbd428fc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Apr 2023 07:46:12 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3367jFkZ037592; Thu, 6 Apr 2023 07:46:11 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3pptjuugdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Apr 2023 07:46:11 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3367kBG6013933; Thu, 6 Apr 2023 07:46:11 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3pptjuugd0-1; Thu, 06 Apr 2023 07:46:10 +0000 From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Cc: error27@gmail.com, kernel-janitors@vger.kernel.org, Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>, "James E.J. Bottomley" <jejb@linux.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, John Garry <john.g.garry@oracle.com>, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH next] scsi: scsi_debug: Fix missing error code in scsi_debug_init() Date: Thu, 6 Apr 2023 00:46:07 -0700 Message-Id: <20230406074607.3637097-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-06_02,2023-04-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060068 X-Proofpoint-ORIG-GUID: RejnskUDGrw5vYzKs-DyvavE5uh8H8w5 X-Proofpoint-GUID: RejnskUDGrw5vYzKs-DyvavE5uh8H8w5 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762413027688208111?= X-GMAIL-MSGID: =?utf-8?q?1762413027688208111?= |
Series |
[next] scsi: scsi_debug: Fix missing error code in scsi_debug_init()
|
|
Commit Message
Harshit Mogalapalli
April 6, 2023, 7:46 a.m. UTC
Smatch reports: drivers/scsi/scsi_debug.c:6996
scsi_debug_init() warn: missing error code 'ret'
Although it is unlikely that KMEM_CACHE might fail, but if
it does then ret might be zero. So to fix this explicitly
mark ret as "-ENOMEM" and then goto driver_unreg.
Fixes: 1107c7b24ee3 ("scsi: scsi_debug: Dynamically allocate sdebug_queued_cmd")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is from static analysis, Only compile tested.
---
drivers/scsi/scsi_debug.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On 06/04/2023 08:46, Harshit Mogalapalli wrote: > Smatch reports: drivers/scsi/scsi_debug.c:6996 > scsi_debug_init() warn: missing error code 'ret' > > Although it is unlikely that KMEM_CACHE might fail, but if > it does then ret might be zero. So to fix this explicitly > mark ret as "-ENOMEM" and then goto driver_unreg. > > Fixes: 1107c7b24ee3 ("scsi: scsi_debug: Dynamically allocate sdebug_queued_cmd") > Signed-off-by: Harshit Mogalapalli<harshit.m.mogalapalli@oracle.com> > --- thanks Reviewed-by: John Garry <john.g.garry@oracle.com>
Harshit, > Smatch reports: drivers/scsi/scsi_debug.c:6996 > scsi_debug_init() warn: missing error code 'ret' Applied to 6.4/scsi-staging, thanks!
On Thu, 06 Apr 2023 00:46:07 -0700, Harshit Mogalapalli wrote: > Smatch reports: drivers/scsi/scsi_debug.c:6996 > scsi_debug_init() warn: missing error code 'ret' > > Although it is unlikely that KMEM_CACHE might fail, but if > it does then ret might be zero. So to fix this explicitly > mark ret as "-ENOMEM" and then goto driver_unreg. > > [...] Applied to 6.4/scsi-queue, thanks! [1/1] scsi: scsi_debug: Fix missing error code in scsi_debug_init() https://git.kernel.org/mkp/scsi/c/b32283d75335
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index cf3f58e8f733..f4fa1035a191 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -6992,8 +6992,10 @@ static int __init scsi_debug_init(void) sdebug_add_host = 0; queued_cmd_cache = KMEM_CACHE(sdebug_queued_cmd, SLAB_HWCACHE_ALIGN); - if (!queued_cmd_cache) + if (!queued_cmd_cache) { + ret = -ENOMEM; goto driver_unreg; + } for (k = 0; k < hosts_to_add; k++) { if (want_store && k == 0) {