From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9F0F28BA87 for ; Mon, 14 Apr 2025 18:28:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744655327; cv=none; b=Uu/twF8hfiLkWuutPhW7hFvLd+2no5l8mPx/LyADfVICGXTlEY3NbuEgUs5Lg0SIbdSdmPOIQwGEcXaYUPLEwBP0zSWqq4WtSd2+E/s6lFfQzSUedYVAVlZBrBukMxMSFdZV0m+eaZzjZtYGQI0EdGum9lQ+VlCRYlEc1hTpITE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744655327; c=relaxed/simple; bh=8P8YmJ7Tn5GGCxfDr6c5P89x/QkiNHi9LhfKdaKuiAE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gBonaMNRE+jJw9pK0jMbWluTNNOx1qHWpG6QTkuYSo2ntxmwkBSNO0k40pY/sdyGu+MzWRNkn7u2RlBpfLIq/w8Pn6kRThWoWdqXrR81gerVv+OM9HfIc0CIg2fE+LU21Aqb58xKQBZ3iQl++l52Rh4sxBIEdFPOCZC4GLjd8Qs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dSjZVNzn; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dSjZVNzn" Date: Mon, 14 Apr 2025 11:28:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744655312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=79LobGIFN/g0FwF2NikibVInqu9FRxv0v1rsKL+0J5s=; b=dSjZVNznhibE5ImQIIfmmYSCOEzofqKsfqXGZNrhtpM/7rWjE+O4flqhBfgr5HDSfKQHPR YBw5wp5OGPuj3czpGhC3nHMcfr4enPcFZPyfeO6MgofxP3O9atH+Z2DrN4HJ9OLmMz7yXe bBaA08prdifZ5EgLcXYZKc1nO9Qvlt0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: David Binderman Cc: "maz@kernel.org" , "joey.gouly@arm.com" , "suzuki.poulose@arm.com" , "yuzenghui@huawei.com" , "pbonzini@redhat.com" , "shuah@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "kvm@vger.kernel.org" , "linux-kselftest@vger.kernel.org" Subject: Re: linux-6.15-rc2/tools/testing/selftests/kvm/lib/arm64/processor.c:107: Possible int/long mixup ? Message-ID: References: Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Mon, Apr 14, 2025 at 06:02:45PM +0000, David Binderman wrote: > Hello there, > > Static analyser cppcheck says: > > linux-6.15-rc2/tools/testing/selftests/kvm/lib/arm64/processor.c:107:2: style: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn] > > Source code is > > return 1 << (vm->va_bits - shift); > > Maybe better code: > > return 1UL << (vm->va_bits - shift); > This expression is at most 8192 so there's no risk of truncation, although the return type could potentially be improved. Thanks, Oliver