Received: by 10.223.185.116 with SMTP id b49csp6303299wrg; Wed, 28 Feb 2018 07:15:23 -0800 (PST) X-Google-Smtp-Source: AH8x225utIPAlECLFIBV5Mtq6pnlxQbvVlM4NwNCJhgUf2KTip0cn3xa0MlnZNj6tDsQWVNnMKpt X-Received: by 2002:a17:902:bc41:: with SMTP id t1-v6mr18620477plz.436.1519830923630; Wed, 28 Feb 2018 07:15:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519830923; cv=none; d=google.com; s=arc-20160816; b=JLEKVyVkhWcuSVu8C8KiKskWaqHHHB+/zHc5fyo1HGXQ03Jeo3zRIOIFjjNQ5VfiVJ l8gqlwVEylPEF99NxQxAk9JEC2Z0oKyh6epWszE+IRyRea1vEEh9L1M77yD7xVnm8C7g IrSdBnNp3Gq9IfD+q/A/ohgB+bOdFjLSCvh8GnrSKx9NAZw9YrDqgBlqFV8Qli9DAJgy kDS56L1IoEUEltvjsz59xpdDLawf4PXxufqDuPSOQeQgGOrd2xSTJq3ux9h8i9o9FfOh gPpw7PVtR3BRGGNBOYIjUeWCvuFW3vuMybUKvYcf1hq8E6gGrhP2bhVYlHKVMUGHGf9G zPxw== 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 :arc-authentication-results; bh=YCJZlabvDEXDHR3psGVnGrrvASbk4WPc2rv41AOpwLo=; b=qhKtHOPSjRj6/qUMc4AmihdO66RisGuQrpkn9uvhM15TxdjCAoZufg4GaJk8l4kxDq 3MBitxk/sGAAiBLia/DpTtIz9DgfVc7lMXb3Z0/3BiUe4GhPd9LPBMSF3eN1vshxyfzR cmXY4jm8hzKf66tBAUcuM37xmLFp7toGX/tKPwpnHGaU4WahkItRBjcDpfAviEebXXhn Ff1TcMsQC2bgwWbPMhYekos35awffEFWwQcm68QRjQPwDUaRmqSqRRs+oZVfVUrpYHUj tXOoc3xZRNR2Vkdx/MljJkuLY5UzYF5GC2FML+msBhHD2kd8h8FO31gwE1+yV7CBjR3P hnww== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si1146765pgr.37.2018.02.28.07.15.06; Wed, 28 Feb 2018 07:15:23 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932268AbeB1PNw (ORCPT + 99 others); Wed, 28 Feb 2018 10:13:52 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51734 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752803AbeB1PGh (ORCPT ); Wed, 28 Feb 2018 10:06:37 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9AC98EAEAA; Wed, 28 Feb 2018 15:06:36 +0000 (UTC) Received: from localhost (ovpn-112-57.ams2.redhat.com [10.36.112.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E2EA10AF9D1; Wed, 28 Feb 2018 15:06:36 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: linux-kernel@vger.kernel.org Cc: arnd@arndb.de, bhe@redhat.com, slp@redhat.com, mst@redhat.com, somlo@cmu.edu, xiaolong.ye@intel.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v16 04/11] fw_cfg: fix sparse warnings around FW_CFG_FILE_DIR read Date: Wed, 28 Feb 2018 16:06:08 +0100 Message-Id: <20180228150615.17317-5-marcandre.lureau@redhat.com> In-Reply-To: <20180228150615.17317-1-marcandre.lureau@redhat.com> References: <20180228150615.17317-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 28 Feb 2018 15:06:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 28 Feb 2018 15:06:36 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use struct fw_cfg_files to read the directory size, fixing the sparse warnings: drivers/firmware/qemu_fw_cfg.c:485:17: warning: cast to restricted __be32 Signed-off-by: Marc-André Lureau --- drivers/firmware/qemu_fw_cfg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c index 0eb155fdfb35..00ad9b862414 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -496,19 +496,20 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f) static int fw_cfg_register_dir_entries(void) { int ret = 0; + __be32 files_count; u32 count, i; struct fw_cfg_file *dir; size_t dir_size; - fw_cfg_read_blob(FW_CFG_FILE_DIR, &count, 0, sizeof(count)); - count = be32_to_cpu(count); + fw_cfg_read_blob(FW_CFG_FILE_DIR, &files_count, 0, sizeof(files_count)); + count = be32_to_cpu(files_count); dir_size = count * sizeof(struct fw_cfg_file); dir = kmalloc(dir_size, GFP_KERNEL); if (!dir) return -ENOMEM; - fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(count), dir_size); + fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(files_count), dir_size); for (i = 0; i < count; i++) { ret = fw_cfg_register_file(&dir[i]); -- 2.16.1.73.g5832b7e9f2