From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FC391171C for ; Fri, 1 Dec 2023 15:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0AT5rYsZ" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5c641d55e27so631941a12.1 for ; Fri, 01 Dec 2023 07:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701446162; x=1702050962; darn=lists.linux.dev; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=T+9aLJpGyu0Q/y7mwBTnwWcmuz7X2zXjBIdqmSWvzkk=; b=0AT5rYsZ1JBKbfh4RmAwqbLMY7eD+ul4QFZtDW5t2YGIzdncDQqMvxF8PPrDMAlG4G M1Y63NiVuIubuiMoY5t++YWMFE749TFk0X/oRSoAFn3GTVj3ovBYFDuuo6wB9zZSy3k+ ESrJdN08V0tWSF9uMCHU+YnZw6LcjtLPNe9WCI8gbZqa/TuZaKPhM5M5axs8xn/Y2ibR q9GJwbcj4Xu3hnfPxJHZCq5sNKpqpHbTvztiDbVg72Yevig+K/7BQAsCydQaBGitNGLP N8nzKc7+Hl+SlvyF8QY7ug9hcrDswv0rcsmGs/RxKgqX2DvtfWZlRpZHf1akNahjcqtL 6hNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701446162; x=1702050962; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T+9aLJpGyu0Q/y7mwBTnwWcmuz7X2zXjBIdqmSWvzkk=; b=JZ9jMK7YQL8TusRlHdvt9NsWqZGr3zVpsM/7MrVJ/a/5LaC0Xy/W7rsax4qDV80mVJ aYTArWrzCXwvzBOGjuvhslxzUE4IH/fVFqY5ky/IsWQNuwZyQJo2XpPJ+u85NOC2YezY X3CmxF4V8ML5WVN6LC1KdOWqbnEnZoXPLbZmkzeylRR41TCr9yXhw2jE7z3TxLokFqbF Vr98zpk2k0jE8IL12FnmdokVP2UxNN1E8efgUaxZv2jTUzCPihOcRN+xzzDaKfjbzMYw IKHltpWPUDXSsL2NKzUIt+R15XHNLwaFr/jpr+ZSrCb2Zl9NUhRG63lhyckmMa2nypuo tDyA== X-Gm-Message-State: AOJu0Yxa5aMOr5o9zjtTqFWhDpD5Cwm6/1JimnjdK+YVPFS3WvJR/0V1 m74gYVU/XbjEQynrFCZRWGRRmk+9UmI= X-Google-Smtp-Source: AGHT+IEIZp/UjGQmIqcjxLcrjtAVgVHJtCowAaXJ8Z6oo7dg35tnLSRyZWGu2wbxgV7cxavSU+m4ulAH0aE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a63:5c0f:0:b0:5c6:504:7e22 with SMTP id q15-20020a635c0f000000b005c605047e22mr1192330pgb.5.1701446162412; Fri, 01 Dec 2023 07:56:02 -0800 (PST) Date: Fri, 1 Dec 2023 07:56:01 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: oe-kbuild-all@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <202311302231.sinLrAig-lkp@intel.com> <87v89jmc3q.fsf@redhat.com> Message-ID: Subject: Re: arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (1b009b becomes 9b) From: Sean Christopherson To: Yujie Liu Cc: Vitaly Kuznetsov , kernel test robot , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Paolo Bonzini , kvm@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Fri, Dec 01, 2023, Yujie Liu wrote: > On Thu, Nov 30, 2023 at 09:49:43AM -0800, Sean Christopherson wrote: > > On Thu, Nov 30, 2023, Vitaly Kuznetsov wrote: > > > kernel test robot writes: > > > > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > > > head: 3b47bc037bd44f142ac09848e8d3ecccc726be99 > > > > commit: a789aeba419647c44d7e7320de20fea037c211d0 KVM: VMX: Rename "vmx/evmcs.{ch}" to "vmx/hyperv.{ch}" > > > > date: 1 year ago > > > > config: x86_64-randconfig-123-20231130 (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/config) > > > > compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07) > > > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231130/202311302231.sinLrAig-lkp@intel.com/reproduce) > > > > > > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > > > > the same patch/commit), kindly add following tags > > > > | Reported-by: kernel test robot > > > > | Closes: https://lore.kernel.org/oe-kbuild-all/202311302231.sinLrAig-lkp@intel.com/ > > > > > > > > sparse warnings: (new ones prefixed by >>) > > > > arch/x86/kvm/vmx/hyperv.h:79:30: sparse: sparse: cast truncates bits from constant value (a000a becomes a) > > > > > > This is what ROL16() macro does but the thing is: we actually want to > > > truncate bits by doing an explicit (u16) cast. We can probably replace > > > this with '& 0xffff': > > > > > > #define ROL16(val, n) ((((u16)(val) << (n)) | ((u16)(val) >> (16 - (n)))) & 0xffff) > > > > > > but honestly I don't see much point... > > > > Yeah, just ignore 'em, we get the exact same sparse complaints in vmcs12.c and > > have had great success ignoring those too :-) > > Thanks for the information. We've disabled this warning in the bot to > avoid sending reports against other files with similar code. I would probably recommend keeping the sparse warning enabled, IIRC it does find legitimate bugs from time to time. Or are you able to disable just the ROL16() warning? If so, super cool!