Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3147634rwb; Fri, 11 Nov 2022 23:27:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4OJCDDO2G1uhd05X520ad+Im7I6QtK84ask9cWaZ17J1Sz1N4LelvEbcfUjj22lx9+GK0F X-Received: by 2002:a17:90a:e517:b0:212:e891:f08d with SMTP id t23-20020a17090ae51700b00212e891f08dmr5403665pjy.18.1668238071661; Fri, 11 Nov 2022 23:27:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668238071; cv=none; d=google.com; s=arc-20160816; b=IZcfMx1vFkhifT7j/BgMu3jzOa9d0n9TWaJR0fpvD3341VmAQIN0VOGrQg4lADNWiw lQgkuQN1iPC6KPS42CTNT8rrwa6p50TyRZaS9YbzC0sBQ08PzQLzSpD2VlN39w79iOJY JAu1ck6p1gpzF3c/O/sU0D7SdOVH87tQVkclBVOm4C3XOPsJbXoItDrWfc7Rd/MvrytM X/ZWYu3ZgKowSvbd12cTHkbQ8Nrv9KSKH6zakEnQ+BnA/H1tgwGSR5Ns3Vx9rS/3NAXU XLCxAMQxBcbeF59ftvJ4Y2fVXS7DSye8qujX1OT6cEunpkWym6rI1Yo1VbvLHJoTVL29 rbrw== 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=gDZ6MG+tnirLjij+RM1xUgF3hdmZdeFJrSWDvS2APYA=; b=aT3BIjpRoBPiLP1liFevzH1e1T+HSbohvl/1/bgnUW8ZvTV2HrqnlHsXVznqHnChfh /mwArCw4/SSS+KKh9pHySDZ/ZiXmkn73rsWCHEcmmt1PU5amS3hUEV5c/1Nb3avJO01m aiJDnYt/trq6qYDey7PWHFFppb36BvmhCI5sqbCHUL+xhvk6wDEt46V82jxGaaJMQhXb b25OuYL53zSAfd5Wy4jaNqHcJl6+hVsmwIZGdEuEbwWIfgGMJzuH3V6qSZUfKCq/yVsL A+FtWwDeVUp+O5nA7Zr+9LnReObJ/xFXPq9R3UjAso/EXQ0CZGW+fPOF+NGwqYcbqUOo +ngg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@oracle.com header.s=corp-2022-7-12 header.b=LOInsb7q; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a17090aad9100b0021343bcdf6csi4185585pjq.48.2022.11.11.23.27.34; Fri, 11 Nov 2022 23:27:51 -0800 (PST) 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=LOInsb7q; 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 S234624AbiKLHN4 (ORCPT + 92 others); Sat, 12 Nov 2022 02:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiKLHNy (ORCPT ); Sat, 12 Nov 2022 02:13:54 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B14511583B; Fri, 11 Nov 2022 23:13:51 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2AC7BZft030768; Sat, 12 Nov 2022 07:13:46 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=gDZ6MG+tnirLjij+RM1xUgF3hdmZdeFJrSWDvS2APYA=; b=LOInsb7qXb1FpC2Phhs6Cp1jyZxX4lh98vHNv7oSfIgKMYDsKOesYjpB9/7vURyTTDns Ft6ABtaDFSVKxEZu+Gktigxn5hJq4upDT531RckV2fG1OcI21clx+HG16rGJ66Cwqy8C VW6dX2aueTLKiluxHVqWEGzDDGm+LQObD4H/Ta99WZwZONHKwdU3uCeSbU8fTLW1SC+S 2LjbAIhGj9q5BwvSkxc0Q+/LDCv1zMxaMYmx0br7yFtESoZc7EGmAgJ8wYKWwmUj7B7q hQbdBQWyvvhrQgf4GtLoPl4Rfp4kWxT42DhzfU9ancP/GF+nSEqOtkabN7dW1gWReoQ2 NQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kt6vjr03f-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 12 Nov 2022 07:13:46 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AC4S1qM038037; Sat, 12 Nov 2022 07:00:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kt1x25jx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 12 Nov 2022 07:00:44 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AC70hSS012960; Sat, 12 Nov 2022 07:00:43 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3kt1x25jwk-1; Sat, 12 Nov 2022 07:00:43 +0000 From: Harshit Mogalapalli Cc: harshit.m.mogalapalli@oracle.com, error27@gmail.com, harshit.m.mogalapalli@gmail.com, "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Douglas Gilbert , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: scsi_debug: Fix a warning in resp_verify() Date: Fri, 11 Nov 2022 23:00:31 -0800 Message-Id: <20221112070031.2121068-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-12_04,2022-11-11_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211120051 X-Proofpoint-GUID: er5ZAZG1nXXdrbj9x89ZZyO--BBTB1dU X-Proofpoint-ORIG-GUID: er5ZAZG1nXXdrbj9x89ZZyO--BBTB1dU X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org As 'vnum' is controlled by user, so if user tries to allocate memory larger than(>=) MAX_ORDER, then kcalloc() will fail, it creates a stack trace and messes up dmesg with a warning. Add __GFP_NOWARN in order to avoid too large allocation warning. This is detected by static analysis using smatch. Fixes: c3e2fe9222d4 ("scsi: scsi_debug: Implement VERIFY(10), add VERIFY(16)") Signed-off-by: Harshit Mogalapalli --- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 697fc57bc711..cbb9395c90c1 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -4429,7 +4429,7 @@ static int resp_verify(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) if (ret) return ret; - arr = kcalloc(lb_size, vnum, GFP_ATOMIC); + arr = kcalloc(lb_size, vnum, GFP_ATOMIC | __GFP_NOWARN); if (!arr) { mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, INSUFF_RES_ASCQ); -- 2.38.1