Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6923431pxv; Fri, 30 Jul 2021 06:01:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw11uGvuFdOCK0AeidiIphJjQxwyNVflml5AQ+qC505fRgBYplkIpaIkxlh76XX44K539Lr X-Received: by 2002:a05:6638:3796:: with SMTP id w22mr2071080jal.34.1627650061479; Fri, 30 Jul 2021 06:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627650061; cv=none; d=google.com; s=arc-20160816; b=cL764YOU+fi1H0CrlA/78RrMqDvE/DFlKXqBAZs9Q3U1eyvPxuTujnFQwDQKfe3Ttr ON37gQQhOt4ThbHOAG3RtcBow4HxpFGeaAaGNsLlfPO/B8sQSmqeLjtlSR117ZStfC5q LbwTFsgN53cOV0RTjUhZsXITrtNPitKYYB+OSV1w+hh3nCMyLRh+iFbVMKWhUM2vWIEn hTqESSvGIMxmxMUfmEm7ZfPpuUrQqsYA81jJmS/0Yvlm+lc5NMpchjRLP61Ozi29yqM6 iiuQtseZAn2fq81D8Cvw4hOzMozbnRc3YpZ0Vo/Cd+Z8oiPf09qejLXnqhNxONZUS1Rr ih1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-signature; bh=AI0V//2zVsMuZfneHsqsJSM47qAEWrYYFG5ZTnS57nQ=; b=VMtZMjY//TODWjzq93XWwUYfD+gAwBWp60rsXGFgPsnGQJui2UJWroWrALsUfWlyyp vwuDt0ErfmQeCOOklYSHRX92t5ts1VPky3TcBYlVuYuiF4MGTP61IeodsLTZfOsoYtxT 8lPh+2F3T2KJhFqVFBmxToXf8FqzPQzdcVQ0T2mj74IQ/a7V7xE14Ews9m+zRGr6FU5u dd56I2WVxvdB8ZCb7EH8x2g5ioWJAKD8uiweNLMZW/gSevD4tC8BSpl+Pw1hxFVcVSfV 8Qg3fDvWOjUg655tcUVC8lOrOuqB0m2X+5VfV1ByyPiLj2rpRR5yZXHHWL+fcn2sObug 8Sow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=jCTDWOnB; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=oz7qRTux; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si1832226ili.154.2021.07.30.06.00.43; Fri, 30 Jul 2021 06:01:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=jCTDWOnB; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=oz7qRTux; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238908AbhG3NAA (ORCPT + 99 others); Fri, 30 Jul 2021 09:00:00 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:35028 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238901AbhG3NAA (ORCPT ); Fri, 30 Jul 2021 09:00:00 -0400 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8596D22439; Fri, 30 Jul 2021 12:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1627649994; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AI0V//2zVsMuZfneHsqsJSM47qAEWrYYFG5ZTnS57nQ=; b=jCTDWOnB11Qu+LiY9hT/SMCuSYWu8qF4qe5iDT0gqwp2nvpINvd5P1Fa34BkVHSTBakZv2 umylYmr1i17mOqKDiIZeXln+s4a+yoGl0AzjAEGEflSTDnngkIRJ5wf6Wgpwjl4SLbMIsR azpPdj4M7JIqNTAHIOQff/Jtxxns/k0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1627649994; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AI0V//2zVsMuZfneHsqsJSM47qAEWrYYFG5ZTnS57nQ=; b=oz7qRTux81XL/3fBk68FzWDX3UjutEyewmRo3uC5rDLJaOFGpya7p7qed2d0CIn/BCJvN5 apxGpS1vcA6z0yCA== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 396C1137E1; Fri, 30 Jul 2021 12:59:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id dM2yC8r3A2HDXwAAGKfGzw (envelope-from ); Fri, 30 Jul 2021 12:59:54 +0000 Date: Fri, 30 Jul 2021 14:59:53 +0200 From: Jean Delvare To: Tiezhu Yang Cc: kernel test robot , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Thomas Bogendoerfer Subject: Re: drivers/firmware/dmi_scan.c:151:9: sparse: sparse: incorrect type in argument 1 (different address spaces) Message-ID: <20210730145953.43308750@endymion> In-Reply-To: <20210729164533.48fed217@endymion> References: <202107242204.IbnaQfeL-lkp@intel.com> <81c31d99-82dc-feb6-1213-2b2fbae7c867@loongson.cn> <20210729164533.48fed217@endymion> Organization: SUSE Linux X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Jul 2021 16:45:33 +0200, Jean Delvare wrote: > On Mon, 26 Jul 2021 20:53:42 +0800, Tiezhu Yang wrote: > > I think the following change can make the above warning silent: > > > > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c > > index f191a1f..9e254d9 100644 > > --- a/drivers/firmware/dmi_scan.c > > +++ b/drivers/firmware/dmi_scan.c > > @@ -148,7 +148,7 @@ static int __init dmi_walk_early(void > > (*decode)(const struct dmi_header *, > > > > add_device_randomness(buf, dmi_len); > > > > - dmi_early_unmap(buf, orig_dmi_len); > > + dmi_early_unmap((u8 __iomem *)buf, orig_dmi_len); > > return 0; > > } > > > > If it is OK, I can send a patch later. > > Explicit pointer casting is almost always the wrong way to make > warnings go away. I can't confirm because I'm not able to get sparse to > work at the moment, but more likely the correct fix would be something > along the lines of: > > --- a/drivers/firmware/dmi_scan.c > +++ b/drivers/firmware/dmi_scan.c > @@ -137,7 +137,7 @@ static phys_addr_t dmi_base; > static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, > void *)) > { > - u8 *buf; > + u8 __iomem *buf; > u32 orig_dmi_len = dmi_len; > > buf = dmi_early_remap(dmi_base, orig_dmi_len); > @@ -754,7 +754,7 @@ static BIN_ATTR(DMI, S_IRUSR, raw_table_ > static int __init dmi_init(void) > { > struct kobject *tables_kobj; > - u8 *dmi_table; > + u8 __iomem *dmi_table; > int ret = -ENOMEM; > > if (!dmi_available) > @@ -1101,7 +1101,7 @@ EXPORT_SYMBOL(dmi_get_bios_year); > int dmi_walk(void (*decode)(const struct dmi_header *, void *), > void *private_data) > { > - u8 *buf; > + u8 __iomem *buf; > > if (!dmi_available) > return -ENXIO; > > (Note sure why there are only 2 sparse warnings when the same issue is > present 3 times in the file.) > I took a deeper look at the code. There's currently no easy way to fix these sparse warnings because different architectures have different prototypes for dmi_early_remap() and dmi_early_unmap(). Some have __iomem and some do not. So, for the time being, fixing warnings on some architectures would introduce new warnings on other architectures. I'd rather leave the code as is until this is sorted out (if it can be). -- Jean Delvare SUSE L3 Support