From patchwork Mon Mar 4 19:39:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159572 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4138656jad; Mon, 4 Mar 2019 11:39:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxShBUErlO1cO2pba4FI4UsavaHi8p8RsPVsqCe0mTu8cfIMduRIGxcd15WA+F81jqXygQ1 X-Received: by 2002:a63:cf4c:: with SMTP id b12mr20077411pgj.316.1551728397627; Mon, 04 Mar 2019 11:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551728397; cv=none; d=google.com; s=arc-20160816; b=UhRrDO0Zx1IIvd3QMvNtDirsjoJt+ptTPsjKs/GyFM9To83tM2tYmyKqh7NRbHGK+V txP4YudCa3foweCzinomHI8BshPBFUna+gD8VUcTjrdQ4POpLX9h2rSgGOSJF3NsDsy5 8U++fhFpIpRU3cGjQ6VK3qBV71ugDZC6sddJMDsMH6yUMzrhRqGhtzKPFfshQoT3nU09 s4bAI6RaB9onpcmUE9ysMAT0gXZJ1tvRbouLsL7s16ks0sOCa5V2qJWU2j3zjZyZ42ak 8UCzwGK0m72NOw0mVKan3ArR2JE4bPYX+QEx1wWqlDWMKolmRbpSTA+13HkAKDaZbHQz q5hQ== 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:message-id:date:subject:cc:to:from; bh=nSzk9N1TE0xzLEq4TdUeEExogMJEw3ArXBHhx7l2T0Y=; b=IB10qQneXrESve/gtk+1zX7jxZW/XHR6UjfwHi2fL+GoIgG49Iqwsd4WtSiUxLXTSH JeLz7SzuwC1kfuA1YbO4i9+Bqr4BFwlFK7uJP81rzqnhJqVZZJXmGmEjFZwiySTmXaK4 TmAL3eCLyLREit1IDNIOgGg4+MUhZbpkhEUXiyXZgM9wxgbX0FRQcn+QV8FLVeAYHvca YpZyCJ0Yl2ybi8/Pq5mq5WyF3Y/PP4mFMZTXGJIwUU9G8x6OHzdu75Rv0WW2Rinl/axy jq6d6jfkAafVYlJ34kZ0DYjfKCnlXsMi2n08GQOmBZtARavl4svFH/cIi9qeFHN8VT3I Cydw== 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 k13si6072279pgh.501.2019.03.04.11.39.57; Mon, 04 Mar 2019 11:39:57 -0800 (PST) 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 S1726334AbfCDTjz (ORCPT + 31 others); Mon, 4 Mar 2019 14:39:55 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:36607 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbfCDTjy (ORCPT ); Mon, 4 Mar 2019 14:39:54 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MrQN5-1hM99S1SQ3-00oWXc; Mon, 04 Mar 2019 20:39:37 +0100 From: Arnd Bergmann To: qla2xxx-upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Himanshu Madhani , Quinn Tran , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] scsi: qla2xxx: avoid printf format warning Date: Mon, 4 Mar 2019 20:39:10 +0100 Message-Id: <20190304193917.702601-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190304193917.702601-1-arnd@arndb.de> References: <20190304193917.702601-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:lCcda1YpPw9M+ZtzSbGvp7ECbDox9Y2czsNlWu8nPeD1QnKypkn 3RCtpNbxrvn/CRomx0tdkFzOCd6j0rBeGqgzlISGvYplxOECqu/jeFo/EhBtEqvyMTsWfF+ G0OECMhPbnHGqZ3qQ9cffrFZcsU3iqbsQYO2qQgTXB0fZkDWarVMJLVUkyGxsMV8dWc2BTD uTsOH5LrhJcDaeu5qBlNw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:qV24WC/GyAE=:fa5fNZ/WYTRMsV3nDc72BR oI3/uB0ISYdDKUwzki/EiHmxi9d32AZ9fxOWsK3VHmH8sl7AF0c34eEknDWWfzNt3Z4vg4nkC QVzXZmDD1FI2S49mgtyQxtfsgUpFoGlqVDbt3jwaTAf0YdYEjSBGaOrM1n1Mhsr7ffMVgFBHf OIr81U4zq3jfyJCjcDMRrep6vxUflMiAKvG5VixCWSQ4puXPURxGDt853YiV+d3wqJtMrkuHg x4cEqXMAGKOminLVsYrHSH7QHH5WWNEXBEJ8TE01O5r0GtgAGz2Xmp6nVEOn1oogyMqmhN1za aWmCaX0bXjrgi2CHY+BDJ13VdQ5Wl4MkYg9o+DbyhQqNDY+4SLdhc20uZMz0ySziKIYYgHORt xVEoV5yBWoMOUP6DiKPppcG6/vYPDLrNhu25C9Fs6OMmy4uO630at5eU5gJT8GFGHE3T8Pk2D xpPzhO8AZ8fY2WK/1UZ0h48pPN8vaL6axHFBaT77VnHHJzyL34K/CUfRkxXSybk941KX/gXH/ TGZjGz5gaTYWdcj1V+mPeZ4UWsmSGvEdKClyhb7QSVxcqizoVSY4CCmKSh5etZKSkC/HhtR7a SijgBEv0muTE7/QioemOxg//yLCf6lGtoRYTQH/gjnk0FsEJ3XScevfqvl3NNAJJHrKgoO2i4 P7YOLcPNa2cW+TVQRYocztT6y5gHKWg0ztD3TSXR5Hm+GVlGK16WZen/qS3c1FBOJNHSMGgj3 wGYFinwrQ5jOAsANzTskJ7YaqUtRacsPiVO5gQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Depending on the target architecture and configuration, both phys_addr_t and dma_addr_t may be smaller than 'long long', so we get a warning when printing either of them using the %llx format string: drivers/scsi/qla2xxx/qla_iocb.c: In function 'qla24xx_walk_and_build_prot_sglist': drivers/scsi/qla2xxx/qla_iocb.c:1140:46: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=] "%s: page boundary crossing (phys=%llx len=%x)\n", ~~~^ %x __func__, sle_phys, sg->length); ~~~~~~~~ drivers/scsi/qla2xxx/qla_iocb.c:1180:29: error: format '%llx' expects argument of type 'long long unsigned int', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=] "%s: sg[%x] (phys=%llx sglen=%x) ldma_sg_len: %x dif_bundl_len: %x ldma_needed: %x\n", ~~~^ There are special %pad and %pap format strings in Linux that we could use here, but since the driver already does 64-bit arithmetic on the values, using a plain 'u64' seems more consistent here. Note: A possible related issue may be that the driver possibly checks the wrong kind of overflow: when an IOMMU is in use, buffers that cross a 32-bit boundary in physical addresses would still be mapped into dma addresses within the low 4GB space, so I suspect that we actually want to check sg_dma_address() instead of sg_phys() here. Fixes: 50b812755e97 ("scsi: qla2xxx: Fix DMA error when the DIF sg buffer crosses 4GB boundary") Signed-off-by: Arnd Bergmann --- drivers/scsi/qla2xxx/qla_iocb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.0 Acked-by: Himanshu Madhani diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 63f8e3c19841..456a41d2e2c6 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -1132,7 +1132,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp, /* if initiator doing write or target doing read */ if (direction_to_device) { for_each_sg(sgl, sg, tot_dsds, i) { - dma_addr_t sle_phys = sg_phys(sg); + u64 sle_phys = sg_phys(sg); /* If SGE addr + len flips bits in upper 32-bits */ if (MSD(sle_phys + sg->length) ^ MSD(sle_phys)) { @@ -1178,7 +1178,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp, ql_dbg(ql_dbg_tgt + ql_dbg_verbose, vha, 0xe023, "%s: sg[%x] (phys=%llx sglen=%x) ldma_sg_len: %x dif_bundl_len: %x ldma_needed: %x\n", - __func__, i, sg_phys(sg), sglen, ldma_sg_len, + __func__, i, (u64)sg_phys(sg), sglen, ldma_sg_len, difctx->dif_bundl_len, ldma_needed); while (sglen) {