Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5860356ioo; Wed, 1 Jun 2022 14:18:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIbTHCi0WMZL4bkN1t1chF8cZF+Y9i+fXRZpvexaKQQHbv9HNH5X/jL3HihBQbUqUKbc2S X-Received: by 2002:a05:6a00:1783:b0:519:1492:dafb with SMTP id s3-20020a056a00178300b005191492dafbmr1437626pfg.79.1654118323737; Wed, 01 Jun 2022 14:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654118323; cv=none; d=google.com; s=arc-20160816; b=SuxqpdDt0H8mrpyvqDjKQ4wNKLbc/LoGNx1GoWFfSNG6ZamqqnYrKQZ2Hvhoqugi+w CRpAxpmZ4WwV8VWBjRM6ngLZ8xPmVnd3VEWX3XoxSykDIKdpX2XJZ1TOg89JN66UN/5b oPITWJfQUy5wfs+R2EjvE+AMhDX69UyUZHCL+qskgdkrARd0VBqTGW8GfPo/wxW6Q9my uAYoTlNi+gPE8dB9jDa34tSh7uo6VejVTWmHUggxxsTkSomQ04/cOGAV6QITAcSjC58/ Ynw0vIT/06CaoBm8pIHw62O/1zuKcwkeptHrvWjJKSNQ0a20BO3biaedin7SnuQc0Fwz UPuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=8ipXL9Fk0Kuu3g8ktwIVg5cZ06Vzzh1Y8XuXwQ/8KOw=; b=wkDRXHTcxrVwCQIKwqc0UF57Futr1395QKAPFkhwXbhFps+Okmc/54ycCOdGTWY8Kr 1urf5Fp5nESyRjp8GFfDcr0vPzfWA8sSCvS3wiaviJUx3DvX7ft2XciDFKQd+RCiEF90 VPb5hSNo8d0nMfcgvbtToqW73MccYJLMIMFzoVIAm6IkrrSJKOmA/DNR4MFZq0YAw9JL 8OnOuVhpg9pwEQ/4Ek5MrAHd0oO+JqPFE5FF3oeI5T0l2hVsjTp/xciyxRxcrLEAslnf 2vaGG90EWpvO5nnUzW05cietAMWyas1cePPNEWnmoXgC5Oa+fZ5wRZJyRDHkJpAWh4i9 NlrA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f4-20020a170902ce8400b00163f8c2deabsi4320982plg.257.2022.06.01.14.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:18:43 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B4BD11BFEC9; Wed, 1 Jun 2022 13:09:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353780AbiFAQyv (ORCPT + 99 others); Wed, 1 Jun 2022 12:54:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbiFAQyu (ORCPT ); Wed, 1 Jun 2022 12:54:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97A365D36 for ; Wed, 1 Jun 2022 09:54:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 598A1CE1C98 for ; Wed, 1 Jun 2022 16:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81773C385A5; Wed, 1 Jun 2022 16:54:44 +0000 (UTC) Date: Wed, 1 Jun 2022 17:54:40 +0100 From: Catalin Marinas To: Mark Brown Cc: kernel test robot , kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: arch/arm64/kernel/fpsimd.c:1944:55: sparse: sparse: dereference of noderef expression Message-ID: References: <202205280635.XKlMkfKD-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 01, 2022 at 09:50:39AM +0200, Mark Brown wrote: > On Tue, May 31, 2022 at 05:57:42PM +0100, Catalin Marinas wrote: > > This looks wrong indeed. IIUC, something like below but waiting for Mark > > to confirm: > > > > diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c > > index 819979398127..ac521b3403d6 100644 > > --- a/arch/arm64/kernel/fpsimd.c > > +++ b/arch/arm64/kernel/fpsimd.c > > @@ -1965,7 +1965,7 @@ void __efi_fpsimd_end(void) > > 0, > > SVCR_SM_MASK); > > if (!system_supports_fa64()) > > - ffr = efi_sm_state; > > + ffr = false; > > Yes, that looks right - feel free to add my Reviewed-by or I'll > do that when I see the patch sent properly. I'm no longer convinced that's the right fix. In __efi_fpsimd_begin(), ffr is true if either !system_supports_fa64() or SVCR.SM is set. The FFR state would be saved in this case. In __efi_fpsimd_end(), shouldn't we just restore the FFR state if efi_sm_state, irrespective of system_supports_fa64() (as it was checked in the beginning). Something like: diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 819979398127..8bc9080adab2 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -1960,13 +1960,12 @@ void __efi_fpsimd_end(void) * streaming mode. */ if (system_supports_sme()) { - if (__this_cpu_read(efi_sm_state)) { + if (__this_cpu_read(efi_sm_state)) sysreg_clear_set_s(SYS_SVCR, 0, SVCR_SM_MASK); - if (!system_supports_fa64()) - ffr = efi_sm_state; - } + else + ffr = false; } sve_load_state(sve_state + sve_ffr_offset(sve_max_vl()), -- Catalin