Received: by 10.223.185.116 with SMTP id b49csp742082wrg; Wed, 14 Feb 2018 06:22:37 -0800 (PST) X-Google-Smtp-Source: AH8x224PerNRRdG9poEh8Yoe6Gai1TXqJB0vxmgqO21ilbwrX+kiWzBb2TRvu5zuldDTJ5dC2sF3 X-Received: by 10.101.75.70 with SMTP id k6mr712429pgt.335.1518618157579; Wed, 14 Feb 2018 06:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518618157; cv=none; d=google.com; s=arc-20160816; b=mxivArMXG82s8PvKXOQyrC15891YoeYbs7A1L5F/v4QX7GR69zHl+Xr0fM1kvIZ6kX 4NhT+9A68biwcd5jyJFpJpLnqrVfnnVOHyxwxQsMXLdDp9jn8U89UdfbMhmVgqYXWYnf yZkaPkrO19fGxRTKQKEpeY7lX3N3DHlpLU0XT9+di5VAgAUlRRgqN57ukDdkZVcMTVp4 wo4EMQPWBA4AgpbZpo0lpHvXim+EXPgauZi+WSq+hqNpeOuHmbhuEkTgYhCMJ5hM72R0 MWFx8XHcFrbPIYQ03kSKOMjcNqxWfJfERcssAmFIVZAmO1hhTe21/H/ji7M5zskO6wAl 9M0Q== 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=CagzZE1UaYdY/LCAmO+WU+FFa7cONievy0miAySkI4U=; b=dPEUdCJvzSe2h34Oe6sicBJvL4kC6qo+h3Gv8Ke5E8xEmcrWYWEdCT45ncg2UckxvF jsO4wYs9mGgkX5CaC3mfUE+ChKCOZqwr1JcVCiBaPHDtLnMhmZwRvx1w7VjcBM5Fvw9W G7KKPU97Ch+xsK6ddPII2DSsr7ZJ+bhuPp46m1SKyL2Nece0alnVjHmD7ad/Ke2hMH6X AtNM63OqNYbJp6z3NXv2wOHsCytAWmSnPC9A+PFzGsOuewsGUzYBEDhs+yXwjMIXbaCD IBRhCYqQhXjX2MyM4lGhOI+RWg2bsQjRSJwxNc9YMezY3rv3Tcs1iqjoRm+YFj4yI50u t45A== 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 i35-v6si66193plg.48.2018.02.14.06.22.23; Wed, 14 Feb 2018 06:22:37 -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 S1030787AbeBNOUr (ORCPT + 99 others); Wed, 14 Feb 2018 09:20:47 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49258 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030671AbeBNOTM (ORCPT ); Wed, 14 Feb 2018 09:19:12 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFFA3FB651; Wed, 14 Feb 2018 14:19:11 +0000 (UTC) Received: from localhost (ovpn-112-21.ams2.redhat.com [10.36.112.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6EDFC21411B6; Wed, 14 Feb 2018 14:19:11 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: linux-kernel@vger.kernel.org Cc: 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 v14 6/9] fw_cfg: fix sparse warnings around FW_CFG_FILE_DIR read Date: Wed, 14 Feb 2018 15:18:47 +0100 Message-Id: <20180214141850.4017-7-marcandre.lureau@redhat.com> In-Reply-To: <20180214141850.4017-1-marcandre.lureau@redhat.com> References: <20180214141850.4017-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.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 14 Feb 2018 14:19:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 14 Feb 2018 14:19:11 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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 4c4813409447..c4c726841ba7 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -478,18 +478,19 @@ static int fw_cfg_register_dir_entries(void) { int ret = 0; u32 count, i; + struct fw_cfg_files files; 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