Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp92186rwb; Thu, 27 Jul 2023 09:47:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlH1R0IJbhheh5fTrzyBMoJ4TNRbSmAKxe+O0sCDm6P3S0GW8vSVnkTotdTfYI0d7DCTuaLo X-Received: by 2002:a19:7512:0:b0:4fb:9da2:6cec with SMTP id y18-20020a197512000000b004fb9da26cecmr2199798lfe.7.1690476434125; Thu, 27 Jul 2023 09:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690476434; cv=none; d=google.com; s=arc-20160816; b=SuGFcP5pm75P/KJj8cflct1deiRBRWO2AQG4GFQ71Ii/KA76M7mn9Td75NKHsmCntL SIKhV/CozW8SV213sKYAhx2/oq919bdXeoHYTdbDvK/j/R2gvVsUu0ogXDaH1gP/kVD1 SQmxmoGeV+Pp606gQEqVDMsikumfJJcDmU8+T8/fxcvnGS/QFZXjCPv695wF5ZDnRZfo ZjdY/FnQi+rAINm4mfhMIqn6LoEyX07za2qggGn1Kcb2Zb9+6fS0nLXMvlPRfCdTBwdg U3N2molw7VFT5Mt1mBO06pa9oW9iEz+bNLgJx2CpHmATg0eI414fAacy8UvHM1S5Vcbh K/fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=u82Xys59wwqJ3VbusMmJFEcKcOmb+FUOcX4+DYjlbfU=; fh=mZS8HZFU7gN9SBjBWyLh338q0VxeOSiALv0upet84Q8=; b=hEMzOi4EflJM0L4GJEg/mRI8a7e4Gn85qkq1DBJmuGPkQQnmeupkMyCXcL19VXQF9y J+wKF/0qZafh1kxHZXxK3m5zXk9kaEYCG1+gEIyEZhmp7daHMRnDWeCT5rP3BaqGwbo4 /JCO1eMXHZuTodRRdR3SQKvGI/ao/tlS+ms2iVaftkx/HLMxEK/98eAHCPtfyfVmYBE7 MUKidQ3j1YywzP5ys+TT2TnLm2s27+ie5h7lOi2UDlqrlxjaI/fOu5Hc3nXu3KUIwg6E gCBijqYwKRqilYkZF4mA2mJu5tSjSCrl0k3F5F1D+T6bCPd+nLjstk3pIzu6jAOV7acq oxuA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020aa7da07000000b005221f9a302csi1163808eds.678.2023.07.27.09.46.45; Thu, 27 Jul 2023 09:47:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233168AbjG0PkH (ORCPT + 99 others); Thu, 27 Jul 2023 11:40:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232813AbjG0PkE (ORCPT ); Thu, 27 Jul 2023 11:40:04 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 133052122; Thu, 27 Jul 2023 08:40:03 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 17BB7186AAC1; Thu, 27 Jul 2023 18:39:30 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Z4YePX_NlhbN; Thu, 27 Jul 2023 18:39:29 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id B7655186AAA0; Thu, 27 Jul 2023 18:39:29 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id lEd70ON9ivQv; Thu, 27 Jul 2023 18:39:29 +0300 (MSK) Received: from rbta-msk-lt-302690.astralinux.ru (unknown [10.177.233.132]) by mail.astralinux.ru (Postfix) with ESMTPSA id DFA7E186AA6C; Thu, 27 Jul 2023 18:39:28 +0300 (MSK) From: Alexandra Diupina To: "James E.J. Bottomley" Cc: Alexandra Diupina , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, Vladimir Telezhnikov Subject: [PATCH] 53c700: add 'slot' check to NULL Date: Thu, 27 Jul 2023 18:39:25 +0300 Message-Id: <20230727153925.15297-1-adiupina@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'slot' variable allows a NULL value. It is necessary to add a check for a null value to avoid dereferencing the null pointer. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Co-developed-by: Vladimir Telezhnikov Signed-off-by: Vladimir Telezhnikov Signed-off-by: Alexandra Diupina --- drivers/scsi/53c700.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index e1e4f9d10887..8e5468d1733d 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -1598,6 +1598,8 @@ NCR_700_intr(int irq, void *dev_id) printk("scsi%d (%d:%d) PHASE MISMATCH IN SEND MESSAGE %d remain, ret= urn %p[%04x], phase %s\n", host->host_no, pun, lun, count, (void *)temp, = temp - hostdata->pScript, sbcl_to_string(NCR_700_readb(host, SBCL_REG))); #endif resume_offset =3D hostdata->pScript + Ent_SendMessagePhaseMismatch; + } else if (!slot) { + printk(KERN_ERR "53c700: SCSI DONE HAS NULL SCp\n"); } else if(dsp >=3D to32bit(&slot->pSG[0].ins) && dsp <=3D to32bit(&slot->pSG[NCR_700_SG_SEGMENTS].ins)) { int data_transfer =3D NCR_700_readl(host, DBC_REG) & 0xffffff; --=20 2.30.2