Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3557964imm; Fri, 19 Oct 2018 12:39:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV62DSao17DUd2n8hQzfAavQxxye0LPn4qF8itR4T74gR11eimC/d2cpqu27ZhADtKFXmlpk9 X-Received: by 2002:a62:4b09:: with SMTP id y9-v6mr35846490pfa.93.1539977971715; Fri, 19 Oct 2018 12:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539977971; cv=none; d=google.com; s=arc-20160816; b=U4VH6UDz2+xXA3TlldzAmju6RHv1bgkajmFYiZaPa6qi1BVoKKPQ49gt46O8c0I54S iuTrv399YpPJSnOR4P61EcdvXAqHEQ5dykhGI1SHSsIlHfbibZzGzpYVqVynrS/Ojox1 oUjcCs//KZ4/3DRUz8jZf+5PPwNbCyRfqNzwXnQDa6nfY6RJoX7QNTSaTXHRHXMVQVwU /mPUXFHXtm1+urSWt4TdUbKtALihBG5WS+ccx7oxkeEjUaeqEY8O+bcoHqcv8+GDWVsy 9nDEEytUZUO3AzIYane7gl0u0Byu1E1tsRILbyrlbuke6UTIjtHEVZq19Jm++ChWzXgD 7qww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=zkDSVje/CWf6xMIBjOVB5zxQWyR/qFgd8OVphJaQNdM=; b=Mv1AmoFxVf8BI8Q7rWwN7uT/tEm4RddCZlgMu8jAsSYy1+q+GUlMs9iSw6g5zTDalQ sidrs1nD2sg54pxrVqndhg+87gXRZheBwItO9leLSwXVgSAQVQMQfuvnYwocanaMjvvC ZiLEoNndW7uIQE8n4oTlwGyPeuVNb064n6HvnGK6RTd7Nj2zf82cPJPesnjy2Zl8ySo9 RmQzmjsoXNiOnlRjhprBjcyNBzf6cKgrDwsp+CagvQHQQC2ClirbeT+BFzzMXemCm9uJ tg6M+0H85fz9WMoNSjHBonUZdiyE3WKymgEiMYbJAM4bNqiP16TF6Ny4M4fpedZT2PyO L8Nw== 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 h80-v6si27694211pfa.238.2018.10.19.12.39.16; Fri, 19 Oct 2018 12:39:31 -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 S1728032AbeJTDqT (ORCPT + 99 others); Fri, 19 Oct 2018 23:46:19 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33906 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727885AbeJTDqR (ORCPT ); Fri, 19 Oct 2018 23:46:17 -0400 Received: by mail-pf1-f195.google.com with SMTP id f78-v6so11153462pfe.1; Fri, 19 Oct 2018 12:38:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=zkDSVje/CWf6xMIBjOVB5zxQWyR/qFgd8OVphJaQNdM=; b=uTqhxYxQ8qrHcvX4njkl9GeodsSWYRLjN84NcvDQQlzkGVsZ+UbKWW5CKrEVozvt09 4cbW8qhK0LJrTFCbXjxG06z/Hk+CLRGFoerjpTRgFtKfdTjIP6kXVHe9JKXse60g2cEa FKTGannizM4xN3GRLPvS+N+8C5QGVPcLDENpDCyZPBm5gWadjo8OYRV3GE1WWh4UZWsw bu1ayhpJ+wSmYpQKdlpmrL7E0x5h3BDl2MM2cJlBmmvk45SnIMHLiryFPYuuWpUKYDKc ZF+U7+ya9DP6loZ33tCuyUTcguTlRrQ/AXKra0dBi+5qEzTkhXGot+HmX41KMbKVaiZC ZKww== X-Gm-Message-State: ABuFfohSporOd76hecHivrbgYwi7m7/0ln4x/Bhj6reEV+Q2SC5oGaJV Lux+rgoqQKUNUNqjWfGea3g= X-Received: by 2002:a62:f553:: with SMTP id n80-v6mr35697915pfh.59.1539977927939; Fri, 19 Oct 2018 12:38:47 -0700 (PDT) Received: from ?IPv6:2620:15c:2cd:203:5cdc:422c:7b28:ebb5? ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id b62-v6sm43345482pfa.159.2018.10.19.12.38.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 12:38:47 -0700 (PDT) Message-ID: <1539977925.81977.55.camel@acm.org> Subject: Re: [PATCH] scsi/ata: Use unsigned int for cmd's type in ioctls in scsi_host_template From: Bart Van Assche To: Nathan Chancellor , Jens Axboe , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Adaptec OEM Raid Solutions , "Manoj N. Kumar" , "Matthew R. Ochs" , Uma Krishnan , Bradley Grove , Don Brace , Brian King , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, esc.storagedev@microsemi.com Date: Fri, 19 Oct 2018 12:38:45 -0700 In-Reply-To: <20181019175714.444-1-natechancellor@gmail.com> References: <20181019175714.444-1-natechancellor@gmail.com> Content-Type: text/plain; charset="UTF-7" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-10-19 at 10:57 -0700, Nathan Chancellor wrote: +AD4 Clang warns several times in the scsi subsystem (trimmed for brevity): +AD4 +AD4 drivers/scsi/hpsa.c:6209:7: warning: overflow converting case value to +AD4 switch condition type (2147762695 to 18446744071562347015) +AFs--Wswitch+AF0 +AD4 case CCISS+AF8-GETBUSTYPES: +AD4 +AF4 +AD4 drivers/scsi/hpsa.c:6208:7: warning: overflow converting case value to +AD4 switch condition type (2147762694 to 18446744071562347014) +AFs--Wswitch+AF0 +AD4 case CCISS+AF8-GETHEARTBEAT: +AD4 +AF4 +AD4 +AD4 The root cause is that the +AF8-IOC macro can generate really large numbers, +AD4 which don't find into type 'int', which is used for the cmd paremeter in +AD4 the ioctls in scsi+AF8-host+AF8-template. My research into how GCC and Clang are +AD4 handling this at a low level didn't prove fruitful. However, looking at +AD4 the rest of the kernel tree, all ioctls use an 'unsigned int' for the +AD4 cmd parameter, which will fit all of the +AF8-IOC values in the scsi/ata +AD4 subsystems. +AD4 +AD4 Make that change because none of the ioctls expect to take a negative +AD4 value, it brings the ioctls inline with the reset of the kernel, and it +AD4 removes ambiguity, which is never good when dealing with compilers. Reviewed-by: Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4