[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: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Tue, 5 Sep 2023 07:42:18 +0000
  • Accept-language: zh-CN, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=mPkDAnYQHJqcmCq75LxYkg4zpnkkUwhuZK2Yr8VzeXI=; b=Uo11qj9uHx21Zqe4DxQsEjGZeo94E85yYCh10urn1hH4VVzv3978Zq95uO8Lbrm+O/N6VESQWhL5HWxmdr2I1+9wELt/XPvn2u1gYv3DcWnwbIazasT3isRSjDcOXyQdkP/8QNEOtJjRrLyy3fm8SE7J4hkO2Mdgon9bYamkvbOYf6yOr9qMahFZ4Q+s9yUv8QkEo3LKWhOkjqwgFy95kpMTi5qKV562Oef43uYnkTkHhMcI5zM6068BjuRZGM6SHCntFC9krF3a0K6qt923RWvY0/7kOewAdSgYbgiNnSySOdjNDCrzVw+dA4rnB9tZiVpIGSF07wXpPNTfXr7UNQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=adiA1zn/P6n3l1zPuNPm3l5ZCFuG/th9JQ5HYGVhv47mPt7jYZ3Wa8HQheHiHjdqyFmiZQsubL5807sMpRkWTtyTGcqGmq0iCUB+Q4hchcO3pniiWRlx9QlN03T5r3ppZ7ywu39TngGmSN8HU+2SlGBmkwSV2xqiq9pvaF8jw8bpGOvnpB4+8+CDpCUHMrbloVLKwbFm0A8wGljNIqo5/UpzEdEapVREN5lyrGyptMyUWs5yUuv0dW7wqC+7AfEEFJo4R1wzKHN/LfwHh5gExLlLwODgxdSqzBHgcmiVrlkDG0esrioSW/GxxIdh1flfoe1AgRHlHM+tkfXB4lTLVA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 05 Sep 2023 07:43:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZ38sXKQ5hzrjtLkWszUwJKclG67AL2VqA
  • Thread-topic: [PATCH v2 2/2] xen: Change parameter of generic_{fls,ffs}() to unsigned int

Hi Michal,

> On Sep 5, 2023, at 15:31, Michal Orzel <michal.orzel@xxxxxxx> 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: Henry Wang <Henry.Wang@xxxxxxx>

Kind regards,
Henry




 


Rackspace

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