From patchwork Thu Sep 20 10:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10607299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 293C91390 for ; Thu, 20 Sep 2018 10:02:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16C372CE79 for ; Thu, 20 Sep 2018 10:02:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 095592CFBE; Thu, 20 Sep 2018 10:02:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B57B52CE79 for ; Thu, 20 Sep 2018 10:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731780AbeITPpf (ORCPT ); Thu, 20 Sep 2018 11:45:35 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:59998 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727986AbeITPpf (ORCPT ); Thu, 20 Sep 2018 11:45:35 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8KA1wp2116298; Thu, 20 Sep 2018 10:02:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=BFROJCNw1mwXn/8dgDD/ZlfP+4S+Q1xIKraaLa/Xzeg=; b=0wFm/YUH9aLD+bwGWyIfiUqqlvsZRFpZs0TNUB6F8WAsgRnA38Nm+tGRm/mJvB9AL/iV Gfhwr4vYIU4dkKW0BH01PER6DTXWWptTDVdQqeyQjJNlImMgkIFCJz50WsA6KTDY587w W/ZHj1vfDVMveZ9VyE736ur7q90xYNa0oAvY31grpq0rWiPVPiwvnQQOyOlOYEWfXbiJ Hyqu9KSSuzKRhEJZe3PDh9go1aRkatkx/1slx/Idnlr/knzAxmrDEk/QUgyNeI+lWekU 4dWPicoYtSkEuOLKfMtIIZOF3HS4uWeP4C9HkQcmE+Q3KgpkAiCMItEwrtv7qsFYURrT 2w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2mgt1q1pqk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Sep 2018 10:02:48 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w8KA2l99003615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Sep 2018 10:02:48 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8KA2kRh017237; Thu, 20 Sep 2018 10:02:47 GMT Received: from mwanda (/197.232.248.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 20 Sep 2018 03:02:46 -0700 Date: Thu, 20 Sep 2018 13:02:36 +0300 From: Dan Carpenter To: qla2xxx-upstream@qlogic.com, Quinn Tran Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] scsi: qla2xxx: don't allow negative thresholds Message-ID: <20180920100236.GB9551@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9021 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=843 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809200102 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We shouldn't allow negative thresholds. I don't know what it would do but it can't be good. Fixes: 8b4673ba3a1b ("scsi: qla2xxx: Add support for ZIO6 interrupt threshold") Signed-off-by: Dan Carpenter Acked-by: Himanshu Madhani diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index a31d23905753..b28f159fdaee 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -1228,7 +1228,7 @@ qla_zio_threshold_store(struct device *dev, struct device_attribute *attr, return -EINVAL; if (sscanf(buf, "%d", &val) != 1) return -EINVAL; - if (val > 256) + if (val < 0 || val > 256) return -ERANGE; atomic_set(&vha->hw->zio_threshold, val);