Received: by 10.223.185.116 with SMTP id b49csp942354wrg; Fri, 16 Feb 2018 09:38:19 -0800 (PST) X-Google-Smtp-Source: AH8x2265jj/zp/0PX7HtHxmXGrFpulyDnuj95tTg4RDEAlW8USN37t0zsusoocgsLLAqimGsvAFr X-Received: by 2002:a17:902:1486:: with SMTP id k6-v6mr6714696pla.376.1518802699500; Fri, 16 Feb 2018 09:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518802699; cv=none; d=google.com; s=arc-20160816; b=hyjnJsIdbf+U6ZEAIoMtPv+o5mstzXEp1s0YQu9iGEKWRXd7+iS/M9lf4Xo+9/pKqv GmREK3r+qNXX5jbq4rFmy6Ku4fzkHafS4SMrtUFLJsWMgsxte653pW7s7xWiIIamMcd3 DQG0f1d+F6A197PVEcGPLM4KEMytkLvPZUKGdql+WFB7ehFzHF/onzfbkhYkq3oHknt0 Hw9hYGka1qqnk7jasNSzzMflN32OnqVo5YdXpglKpq/RtqGTvjgQe7pPTnLE4s4jGY2e 57rqGzI8pXu0LFfw2vogjEiv5iGWShm+4OWNfgI7BFW4k0m5rMdmNTcW2inxmT4uiiM8 1Uxw== 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=ApqaUUT/R7JLj+5FZWH5wAhhEH3xXhanncolxCc79fM=; b=wsUgZ6PKOE2Dcd88zvXiVdNRX6gFj8vTolQhMPuww82/sRZJYE9UGEwxCO9HoryYVS mrf/rapNKM6WsFq+5CmmVCgOa1ycsnehDvVp8VzChShbFdVpnOlmt9/jy75pQ2ZE7wnA 3r/8GTuiMNPWaZ9Q1ZxUtoFVGLGGoCy7NKzCk8aVis2/9oXd+CHdUYJcRrKhgifemtBv +1r6VKR8Q/Q9gOGQ5E3ztj060N8Sv5/D+70EO5m4CHgBtNc9wboM9qEIk75v+ZpPO2jl nqPQT9nRROdJW/wEJdah5ICAOhnctH48FOX3zubb4g/J6efjHLjiuoR9f/ALxOKxgTo+ fwcA== 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 e5-v6si1100867plo.702.2018.02.16.09.38.04; Fri, 16 Feb 2018 09:38:19 -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 S1163426AbeBOVdn (ORCPT + 99 others); Thu, 15 Feb 2018 16:33:43 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59128 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1163344AbeBOVdl (ORCPT ); Thu, 15 Feb 2018 16:33:41 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98306402291E; Thu, 15 Feb 2018 21:33:40 +0000 (UTC) Received: from localhost (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4907B2024CA7; Thu, 15 Feb 2018 21:33:40 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: linux-kernel@vger.kernel.org Cc: slp@redhat.com, bhe@redhat.com, mst@redhat.com, somlo@cmu.edu, xiaolong.ye@intel.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PATCH v15 06/11] fw_cfg: fix sparse warnings around FW_CFG_FILE_DIR read Date: Thu, 15 Feb 2018 22:33:07 +0100 Message-Id: <20180215213312.29234-7-marcandre.lureau@redhat.com> In-Reply-To: <20180215213312.29234-1-marcandre.lureau@redhat.com> References: <20180215213312.29234-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.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Feb 2018 21:33:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Feb 2018 21:33:40 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 71672cb8c427..805372e8e50d 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -478,19 +478,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