Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5367690imm; Tue, 12 Jun 2018 06:54:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLEtr+wEcv1MZzbb1pVXpvDuzcysr9aarQFBXBjgXLHzGd9gixWFexBUjYfQFsSoRhuhz0O X-Received: by 2002:a17:902:d711:: with SMTP id w17-v6mr545031ply.200.1528811667973; Tue, 12 Jun 2018 06:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528811667; cv=none; d=google.com; s=arc-20160816; b=SjglQVI4YzgY92UO338k+4Rwt6iRoE7VG5M2Q6o0hVL8zv9rYcMZyDp+3zF7ilpOrC QpNSjKRLunxJknLy5n8OmS9tApsr6cZHzEkGN50BaMeaPYOpzSItuT4WDTbrKOO8/Bd0 wAPwMSWSpsXnD570FAKGzWAuDvnoYZBjkphDqWadEjkekhFu713GWpQHqrMT090R4rth Nswa204QmZmd34XBiaYNBILEIwgMLjAbiABcPyLyykqBPfFQ8Y/BvbCMw21SB8LuD8ok kNZrsfyi79+cR9Wvu9lahl1v1nblpmtLyCJH676uKJ4PlpF4X4BOdAaN2GkbHwPYs/4x FYXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=lb3FVMUQ3Nfycjmxmr70f2DwrHz7Kv9MGAP1FEMgduE=; b=vJsJUuAE5A54gNqbkEFwrVhfvb4TmS09nFgJuSB9CJc2/HDZJ6xB720sVeIxLbCwRT QKkUnozhQSUEDTg63RYEQfM9585CSRkxLsRfQ85/AAcPyv/jbIXCdD1RjSIM+/QR5UMC z8J8vc8yV6bthJWwokj4s4KLP6UbnwFqll3MNMMUAi+Qs4wfu/azg9gVaPLLHsjOs0dA sv4R3iuALkZhl6wGC4vDpsyy7jc+jr/9tOj8aU0lw2RPqhyNO+qnNvcYIOuy1saeB9IG 6WG6dYsJ1NmXtFqmb5GUG7uu50MMBHVyjGCMMdyKY8HX0C+nCQjv4dO1PqLymC+8a49v pJtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e90-v6si195323plb.437.2018.06.12.06.54.13; Tue, 12 Jun 2018 06:54:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933985AbeFLNxU (ORCPT + 99 others); Tue, 12 Jun 2018 09:53:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:37560 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933909AbeFLNxS (ORCPT ); Tue, 12 Jun 2018 09:53:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1221FAF18; Tue, 12 Jun 2018 13:53:17 +0000 (UTC) From: Johannes Thumshirn To: "Martin K . Petersen" Cc: Linux Kernel Mailinglist , Linux SCSI Mailinglist , Johannes Thumshirn Subject: [PATCH 3/3] scsi: don't add scsi command result bytes Date: Tue, 12 Jun 2018 15:53:11 +0200 Message-Id: <20180612135311.13216-4-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180612135311.13216-1-jthumshirn@suse.de> References: <20180612135311.13216-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some drivers are ADDing the scsi command's result bytes instead of ORing them. While this can produce correct results it has unexpected side effects. Signed-off-by: Johannes Thumshirn --- drivers/scsi/imm.c | 2 +- drivers/scsi/mesh.c | 4 ++-- drivers/scsi/sym53c8xx_2/sym_glue.c | 2 +- drivers/scsi/sym53c8xx_2/sym_glue.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 87c94191033b..e67033c8011f 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -892,7 +892,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) /* Check for optional message byte */ if (imm_wait(dev) == (unsigned char) 0xb8) imm_in(dev, &h, 1); - cmd->result = (DID_OK << 16) + (l & STATUS_MASK); + cmd->result = DID_OK << 16 | l & STATUS_MASK; } if ((dev->mode == IMM_NIBBLE) || (dev->mode == IMM_PS2)) { w_ctr(ppb, 0x4); diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 1753e42826dd..3473a860e690 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c @@ -594,9 +594,9 @@ static void mesh_done(struct mesh_state *ms, int start_next) ms->current_req = NULL; tp->current_req = NULL; if (cmd) { - cmd->result = (ms->stat << 16) + cmd->SCp.Status; + cmd->result = ms->stat << 16 | cmd->SCp.Status; if (ms->stat == DID_OK) - cmd->result += (cmd->SCp.Message << 8); + cmd->result |= cmd->SCp.Message << 8; if (DEBUG_TARGET(cmd)) { printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n", cmd->result, ms->data_ptr, scsi_bufflen(cmd)); diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 7320d5fe4cbc..afdbd5a66083 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -252,7 +252,7 @@ void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid) cam_status = sym_xerr_cam_status(DID_ERROR, cp->xerr_status); } scsi_set_resid(cmd, resid); - cmd->result = (drv_status << 24) + (cam_status << 16) + scsi_status; + cmd->result = drv_status << 24 | cam_status << 16 | scsi_status; } static int sym_scatter(struct sym_hcb *np, struct sym_ccb *cp, struct scsi_cmnd *cmd) diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h index 805369521df8..25c7478d8810 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.h +++ b/drivers/scsi/sym53c8xx_2/sym_glue.h @@ -256,7 +256,7 @@ sym_get_cam_status(struct scsi_cmnd *cmd) static inline void sym_set_cam_result_ok(struct sym_ccb *cp, struct scsi_cmnd *cmd, int resid) { scsi_set_resid(cmd, resid); - cmd->result = (((DID_OK) << 16) + ((cp->ssss_status) & 0x7f)); + cmd->result = DID_OK << 16 | cp->ssss_status & 0x7f; } void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid); -- 2.16.4