Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3625663imm; Fri, 19 Oct 2018 14:00:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV60B10fr0rBvzLsHyAaO1rnU/Wf2V8SfmvuLA9X8+Mw483mOYQrIJ8o4XNlJNYefhSuH6DLn X-Received: by 2002:a17:902:22cc:: with SMTP id o12-v6mr35769987plg.108.1539982835228; Fri, 19 Oct 2018 14:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539982835; cv=none; d=google.com; s=arc-20160816; b=bd44x5kbkevrKlhvh3ryYeXCFZkDmy6g6aUGiTmq2boN3CGwRMeNtzezI5AzdrYC8M YWL2+t9ddt+ZIxfWeYdO4fCfWdDptiiHfnMmzcVBGxCYamJTzBt5EMGk9rikRd81LfNE Gw8rr0cwJ7bdAcoPAHp4064qsIT8fZpEr3A65FI9D+vUG2e/PsHEAg1meIcemRJ2ij2r UClw+geDeJhxybQG8vlkQaJyIbQ4rs7fW7OGLhUbWoBE2cQAbjA6QJNXCcL1Ljt1NqKp xAuh35JKUbkJVS+kH0YDt9gNkFBHDIxisOpztp5CftnqXqSziriHNNduNsnkQ3Abg8s7 oLSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+q89g1JP+/BTT9VWEclDbxxqLPPAV6In3M7Y30v4eEs=; b=xyZW5QxPqT4akDevfr30yYD5TbfxoLLe4yrwVfFXwLlakwd0R8nj3RBX47ZMT8FSHg 6bEDLzDqzlNVoOpYIm2DTuqRi/RFw5ixsoFT2517Bv5r5Pcd+mQvKUewQJg9OjVldPVi 30O+HkGdsUujzdpS3SQD6cCUMagImokGKQNu1NJDIqwBumRr1AOF0z3ra3XnR+bwO2Nm MA5gm9oVuOENk1jRrt4b9yCdLgbBnUT1m34J17/0KJugOAyNfKaJrqBLGhbnUNPhN7m5 mStA1tBfO6ZDJuOsz37kX9n834yCkASC67x4hECGWI5FS+mSXv7bYewZ6EMd7blqeHGN ZsZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YBzOiixm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b128-v6si24551895pfg.94.2018.10.19.14.00.19; Fri, 19 Oct 2018 14:00:35 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YBzOiixm; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727096AbeJTFHm (ORCPT + 99 others); Sat, 20 Oct 2018 01:07:42 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:34361 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726353AbeJTFHm (ORCPT ); Sat, 20 Oct 2018 01:07:42 -0400 Received: by mail-oi1-f195.google.com with SMTP id v69-v6so27897646oif.1; Fri, 19 Oct 2018 13:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+q89g1JP+/BTT9VWEclDbxxqLPPAV6In3M7Y30v4eEs=; b=YBzOiixmbroxcq5Rtyc7QRmHyLFv43UBiLlwFjas/sDsTNJ3lVXmkfZwGYOhZrA0ac BOSmTArmdvHbvMNqiE8xJnEeAwA71yge02CwcQ2aepXIhO/UoGC+1iEGjKygwqpUhoLo SS7U4XeYQRexn3Sn9k7EVmQituogaE9hs32cUgnW9QcMCmutN+WMLQ4zZZAMqCoA1/Mw hoXr330Kgp6myc7yftdwoCt7gypDywbgm6JHRlCJbBTepZllafRpz8OwF5lSkMe8lnhG 7/f2Tm7Jtfp10/6TMpwWP9JGwujAZ0l/6ndHKd3hV9fAUO0/h5B+sY2xmgOwbc5p8E7J QB9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+q89g1JP+/BTT9VWEclDbxxqLPPAV6In3M7Y30v4eEs=; b=C0+aEAhV0F1bV1hkGH7aGYGDki6NfSz6zYRKRJQVsc4/rQ1vIpeF4Q2ruj5YXAJm7V jD03FbK9WeYjGXztytAHoUcHFWYEzYHNHtUAxSFEQOHKQ0lu27wOCc4tIbo0EK2Jwq1x XTMLP1Mxmi15g/MoaKzaLlBCA2IuiZg3hUeY/fTmzPNimRQ1+ijCBtU1t3yqVf4z02jS zvRwYy8kW2CXnULNqgF5jFMZBTAg/VXhJwGMJpNmCxPA9G5dDbfGmpHvUGLdGUZp2R1Z jLmkx/cN2tU7r2xly4CrpHfdabO3sxE9JqSo3zY7KrS4u0+/eElclWAyM2uZgg68el+7 V0ew== X-Gm-Message-State: ABuFfogjP+vckz4Mnr35TM+/CyCwZCK1NgYNakgP0AzDXPn/G7V0hiHV unuyNJ/CXLFrqm5PGN13tFS9/pLMP82yG+du71M= X-Received: by 2002:aca:e144:: with SMTP id y65-v6mr18038530oig.90.1539982796364; Fri, 19 Oct 2018 13:59:56 -0700 (PDT) MIME-Version: 1.0 References: <20181018215541.4768-1-natechancellor@gmail.com> In-Reply-To: <20181018215541.4768-1-natechancellor@gmail.com> From: adam radford Date: Fri, 19 Oct 2018 13:59:45 -0700 Message-ID: Subject: Re: [PATCH] scsi: 3w-{sas,9xxx}: Use unsigned char for cdb To: natechancellor@gmail.com Cc: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 18, 2018 at 2:55 PM Nathan Chancellor wrote: > > Clang warns a few times: > > drivers/scsi/3w-sas.c:386:11: warning: implicit conversion from 'int' to > 'char' changes value from 128 to -128 [-Wconstant-conversion] > cdb[4] = TW_ALLOCATION_LENGTH; /* allocation length */ > ~ ^~~~~~~~~~~~~~~~~~~~ > > Update cdb's type to unsigned char, which matches the type of the cdb > member in struct TW_Command_Apache. > > Link: https://github.com/ClangBuiltLinux/linux/issues/158 > Signed-off-by: Nathan Chancellor > --- > drivers/scsi/3w-9xxx.c | 12 ++++++++---- > drivers/scsi/3w-sas.c | 8 +++++--- > 2 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c > index 05293babb031..2d655a97b959 100644 > --- a/drivers/scsi/3w-9xxx.c > +++ b/drivers/scsi/3w-9xxx.c > @@ -143,7 +143,9 @@ static int twa_poll_status_gone(TW_Device_Extension *tw_dev, u32 flag, int secon > static int twa_post_command_packet(TW_Device_Extension *tw_dev, int request_id, char internal); > static int twa_reset_device_extension(TW_Device_Extension *tw_dev); > static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset); > -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg); > +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, > + unsigned char *cdb, int use_sg, > + TW_SG_Entry *sglistarg); > static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id); > static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code); > > @@ -278,7 +280,7 @@ static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) > static int twa_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset) > { > int request_id = 0; > - char cdb[TW_MAX_CDB_LEN]; > + unsigned char cdb[TW_MAX_CDB_LEN]; > TW_SG_Entry sglist[1]; > int finished = 0, count = 0; > TW_Command_Full *full_command_packet; > @@ -423,7 +425,7 @@ static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H > /* This function will read the aen queue from the isr */ > static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) > { > - char cdb[TW_MAX_CDB_LEN]; > + unsigned char cdb[TW_MAX_CDB_LEN]; > TW_SG_Entry sglist[1]; > TW_Command_Full *full_command_packet; > int retval = 1; > @@ -1798,7 +1800,9 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ > static DEF_SCSI_QCMD(twa_scsi_queue) > > /* This function hands scsi cdb's to the firmware */ > -static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg) > +static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, > + unsigned char *cdb, int use_sg, > + TW_SG_Entry *sglistarg) > { > TW_Command_Full *full_command_packet; > TW_Command_Apache *command_packet; > diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c > index 266bdac75304..480cf82700e9 100644 > --- a/drivers/scsi/3w-sas.c > +++ b/drivers/scsi/3w-sas.c > @@ -287,7 +287,9 @@ static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id) > } /* End twl_post_command_packet() */ > > /* This function hands scsi cdb's to the firmware */ > -static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg) > +static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, > + unsigned char *cdb, int use_sg, > + TW_SG_Entry_ISO *sglistarg) > { > TW_Command_Full *full_command_packet; > TW_Command_Apache *command_packet; > @@ -372,7 +374,7 @@ static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, > /* This function will read the aen queue from the isr */ > static int twl_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) > { > - char cdb[TW_MAX_CDB_LEN]; > + unsigned char cdb[TW_MAX_CDB_LEN]; > TW_SG_Entry_ISO sglist[1]; > TW_Command_Full *full_command_packet; > int retval = 1; > @@ -554,7 +556,7 @@ static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int se > static int twl_aen_drain_queue(TW_Device_Extension *tw_dev, int no_check_reset) > { > int request_id = 0; > - char cdb[TW_MAX_CDB_LEN]; > + unsigned char cdb[TW_MAX_CDB_LEN]; > TW_SG_Entry_ISO sglist[1]; > int finished = 0, count = 0; > TW_Command_Full *full_command_packet; > -- > 2.19.1 > Looks ok. Signed-off-by: Adam Radford -Adam