[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] xen: Change parameter of generic_{fls,ffs}() to unsigned int


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 5 Sep 2023 09:40:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rDGwdodHeI8Exek8Qg94JKUD6WpPOC1FCUmeGauuBDk=; b=AJ0hj6PYq0oNTMlb4pazdClMRdDE7IegAPqeWyZDYSQvFMQTpDzDrXlSpO1mK9B64FeQlzWYcbzYuDmgOZlKn+Io0g0cTGGiRx+4StGOdCCvrj3eFtKdiCRfErO6ZiQNR9fET6yRha9RiuGhy8iQ61QvrsLoa0c6HS61ZkykezQ6jF64afuzWz1Svtc9yPfKLAlp4T6lMl2R3/Vmku6kAAmsvyBzzVNS8rsx2t0VoZLGaAuJzwHINGpi+oBrWZoJcDvay9e/VYUaPTTbq0Ef4zg+mlwlP8DvOSAdlfj5Jf5XMWQq90+Tti9/kj9mKv0EWWumfs4vLdSoX2oeo+Pl+A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQA7GhtpOcpjajrcN8tP4BsWS1xijlY9QTDOv6uoCMp2XP+uWqO3D0SczQX3IABWCWoLR0/CPjbH8NHR+p9nTqggDglAN7uzmAiLOpyv0Q1C4Lr3gvQq2LNWR44VwntptVhiloTO93BGmeLs0NR/TqGe1EWBRcKiuP8PMQZXyJ6pR4JgaA9NbjXojYNcsnzbpVa04HBm+Ba4Y0ExkOdG4AP7vvWUpKaiaQVUNpvf14gr0U5IHc7u/US9UfI1QzawhEiTDsbKa2z+mS/WtXca8QQbV94rW4Ay74y0jLp3D3ykzH8agD7EqLYd3XlTKGZe/TFjf2//2/tqOmCu9u0H2Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Henry.Wang@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 05 Sep 2023 07:40:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.09.2023 09:31, Michal Orzel wrote:
> When running with SMMUv3 and UBSAN enabled on arm64, there are a lot of
> warnings printed related to shifting into sign bit in generic_fls()
> as it takes parameter of type int.
> 
> Example:
> (XEN) UBSAN: Undefined behaviour in ./include/xen/bitops.h:69:11
> (XEN) left shift of 134217728 by 4 places cannot be represented in type 'int'
> 
> It does not make a lot of sense to ask for the last set bit of a negative
> value. We don't have a direct user of this helper and all the wrappers
> pass value of type unsigned {int,long}.
> 
> Linux did the same as part of commit:
> 3fc2579e6f16 ("fls: change parameter to unsigned int")
> 
> To keep consistency between the helpers, take the opportunity to:
>  - replace __inline__ with inline,
>  - modify generic_ffs() to take parameter of type unsigned int as well
>    (currently no user and the only wrapper generic_ffsl() passes unsigned
>    long).
> 
> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.