From patchwork Fri Oct 19 09:16:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10648903 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 20B4E157A for ; Fri, 19 Oct 2018 09:16:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F07D289FA for ; Fri, 19 Oct 2018 09:16:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0070C28A00; Fri, 19 Oct 2018 09:16:52 +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 99599289FA for ; Fri, 19 Oct 2018 09:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727061AbeJSRWE (ORCPT ); Fri, 19 Oct 2018 13:22:04 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:54772 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbeJSRWE (ORCPT ); Fri, 19 Oct 2018 13:22:04 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9J9E00w178242; Fri, 19 Oct 2018 09:16: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=i8PUWKK1mceFmg7r/BKcAVCDi9k8oLNJSxeVxj478Xk=; b=G4XjQ1fe9u5QsITOS7w1FohQdsVuWCkX3ROox5CGWCkBaVCyKycSM2lr5Ge9q/vJvuCJ Qt6gTXP/oCDfgy6uUNy8jb0evAs2VyMFu6e6GAbrEc/kuaV9Sj7iQBdfq73AnyVQoJEQ B4sJQH+vXfipUQiGunxg7qFBVpqvUA0S7eXbsE4+1EwQzAO7TLUwAcDWGlQ/RyNOtkEe vlOkHUbvki7k4Q76xjgZRzXN+wZgCiqqRdBKMuGtf4Ewi57SzVOV/lxxzc3rNbBC8wFx pw2a/bxI3G85Zu7WTS0gvMjkL4/AZkFKm0j9X45RZn227aPVH078I6yxwJxCrDQEIkWc tQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2n384uk8he-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:16:48 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9J9Gl2a020543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:16:47 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9J9GjeO007716; Fri, 19 Oct 2018 09:16:47 GMT Received: from kili.mountain (/129.205.6.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 19 Oct 2018 02:16:44 -0700 Date: Fri, 19 Oct 2018 12:16:28 +0300 From: Dan Carpenter To: Hannes Reinecke Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/3] scsi: myrs: Fix a logical vs bitwise bug Message-ID: <20181019091628.4pvqvib3nlz2pznb@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9050 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=757 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190084 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 The || was supposed to be |. The original code just sets ->result to 1. Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)") Signed-off-by: Dan Carpenter --- drivers/scsi/myrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c index b02ee0b0dd55..17e691bde485 100644 --- a/drivers/scsi/myrs.c +++ b/drivers/scsi/myrs.c @@ -2085,7 +2085,7 @@ static void myrs_handle_scsi(struct myrs_hba *cs, struct myrs_cmdblk *cmd_blk, status == MYRS_STATUS_DEVICE_NON_RESPONSIVE2) scmd->result = (DID_BAD_TARGET << 16); else - scmd->result = (DID_OK << 16) || status; + scmd->result = (DID_OK << 16) | status; scmd->scsi_done(scmd); } From patchwork Fri Oct 19 09:18:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10648905 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 AFA20112B for ; Fri, 19 Oct 2018 09:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9108428A46 for ; Fri, 19 Oct 2018 09:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82D2828A4B; Fri, 19 Oct 2018 09:18:51 +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 2BB7028A46 for ; Fri, 19 Oct 2018 09:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbeJSRYE (ORCPT ); Fri, 19 Oct 2018 13:24:04 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:60118 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbeJSRYD (ORCPT ); Fri, 19 Oct 2018 13:24:03 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9J9IY9d133927; Fri, 19 Oct 2018 09:18:47 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=97TkF2uaKtdAPGB6lPku22XChdBfSQKsLTly6Ib1FVY=; b=dmFig53K2Ag83XCIuEaqTHSOHAkZFGXA4xfEFRz99gGX2YRXkIBCns+nIfUyFqXoX0us tbNY0RF7pQJo0WAa8jhKi2MJg2+jsB0phsPJrekURO270j7COHkSPKEtujllaGhvy7PP FUMojaBhhirvUuZABvXz7Y7sdLLYlVMwECf5YZsQgfAguVvdHSjLyLl9xXzV9NEnTbTJ PswOSXK/UXd52cWprY0pQuJQp89/Ib+BjpoGYFvIvqK04rrinGeOv2zuObStdvoogjKq kUm1e2/2A11XhnRdvI7CeKE9XkCt5ijz+aaS4gM0H+rOdln0NftIOPORlhGwh7AxHxTO Vg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2n39brtxhg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:18:47 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9J9If0r006046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:18:41 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9J9IeHJ019345; Fri, 19 Oct 2018 09:18:40 GMT Received: from kili.mountain (/129.205.6.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 19 Oct 2018 02:18:40 -0700 Date: Fri, 19 Oct 2018 12:18:19 +0300 From: Dan Carpenter To: Hannes Reinecke Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/3] scsi: myrs: Fix the processor absent message in processor_show() Message-ID: <20181019091819.7q5t2ry67ksoyrgh@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9050 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=569 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190084 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 If both processors are absent then it's supposed to print that, but instead we print that just the second processor is absent. Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)") Signed-off-by: Dan Carpenter --- drivers/scsi/myrs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c index b02ee0b0dd55..07e5a3f54e31 100644 --- a/drivers/scsi/myrs.c +++ b/drivers/scsi/myrs.c @@ -1366,11 +1366,11 @@ static ssize_t processor_show(struct device *dev, first_processor, info->cpu[0].cpu_count, info->cpu[1].cpu_name, second_processor, info->cpu[1].cpu_count); - else if (!second_processor) + else if (first_processor && !second_processor) ret = snprintf(buf, 64, "1: %s (%s, %d cpus)\n2: absent\n", info->cpu[0].cpu_name, first_processor, info->cpu[0].cpu_count); - else if (!first_processor) + else if (!first_processor && second_processor) ret = snprintf(buf, 64, "1: absent\n2: %s (%s, %d cpus)\n", info->cpu[1].cpu_name, second_processor, info->cpu[1].cpu_count); From patchwork Fri Oct 19 09:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10648907 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 6CEA5112B for ; Fri, 19 Oct 2018 09:19:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BD3A28A4A for ; Fri, 19 Oct 2018 09:19:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 504C128A4F; Fri, 19 Oct 2018 09:19:28 +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 0998E28A4A for ; Fri, 19 Oct 2018 09:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727341AbeJSRYl (ORCPT ); Fri, 19 Oct 2018 13:24:41 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:56966 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726970AbeJSRYl (ORCPT ); Fri, 19 Oct 2018 13:24:41 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9J9JOV2182817; Fri, 19 Oct 2018 09:19:24 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=dE/qQAdwl/ArsEGVTddFbwzBAUNXXAFR8N0D1bKxvqs=; b=1hy1mXf7QyyB5PiPmCqpv3jm48XFcQaP1qlhbC9mRtfZnjeDxeHdDFxLS1WDMRlz3qu0 Et+dsauO0nRebqVD+AFFxICWGpkq1j7hWA24AkQcITweCLhtkj3s+411MyjDlFz9rOPQ x4uZlKKQZDzNz2RCVRVvY27Yre55+2cphfYog3fb9LS2s3mo3Q21ymJOdvO+3WX0pMN+ g/wr9U84IbsRRmOQBwLl11Bi3kVX6TbPcgf9ISbiXxBjw266n/+kQUAIECXCzKRsEQjp V03MbOyDq30q/OHvYUP7IR1vjWjBC75mb37kvES9I0lcyaeTfG0xeJZ+eaNcG0aHUBmd Xg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2n384uk8un-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:19:24 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9J9JO8D014962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Oct 2018 09:19:24 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9J9JNOC008516; Fri, 19 Oct 2018 09:19:23 GMT Received: from kili.mountain (/129.205.6.86) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 19 Oct 2018 02:19:23 -0700 Date: Fri, 19 Oct 2018 12:19:09 +0300 From: Dan Carpenter To: Hannes Reinecke Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 3/3] scsi: myrs: prevent negatives in disable_enclosure_messages_store() Message-ID: <20181019091909.a22ah7wybj6agqch@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9050 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=545 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190085 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 only want the value to be zero or one. It's not a big deal, but say we passed set value to INT_MIN, then disable_enclosure_messages_show() would return that 12 bytes of "buf" are initialized but actually only 3 are. I think there are tools like KASAN which will trigger an info leak warning when that happens. Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)") Signed-off-by: Dan Carpenter --- drivers/scsi/myrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c index 07e5a3f54e31..55842ed54231 100644 --- a/drivers/scsi/myrs.c +++ b/drivers/scsi/myrs.c @@ -1501,7 +1501,7 @@ static ssize_t disable_enclosure_messages_store(struct device *dev, if (ret) return ret; - if (value > 2) + if (value < 0 || value > 2) return -EINVAL; cs->disable_enc_msg = value;