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

Re: [PATCH v2] device-tree: fix infinite loop issue in 'assign_shared_memory()'


  • To: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Thu, 28 Aug 2025 11:24:43 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=jsjStin+qEOYqvova+nacGlf0aAi2wYHMPXpupURFgU=; b=TwGxZ6bw5Zt3YrSmTS7edrWURK4xQvAgBHGwR/BVZ7zs9foH+qWtqdyzhjDk3W/Xqr2y9SKQf5CcQmLRiWHzVXnrrDYJUtNbKD6UpbXmZ0S7A5oTRjhjVuR41zEi/a8CuWDI7RbE4cjnLe4ZqXp5T9vsiYKnpoOw2TZRLiZakdyiYPsTfluDlA6rnjc7aEGju6mTVzthYNzMCBkDp0vskSxcv11ogWntAXk4Ou294wfQYgj1agIlueSEDlTaVkpf2FNi9Y8BU1pXVQLViLY/aeJXYX6yqQLpM8dvEoF8qG2PnY7yodA+7MGyywQ9DCiw5lZxOnEZZCRBq/yt+RcaKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Qd795vfGt+npyF8Gmth+tyClRemcXg8E2fTs+jK7kA0YxQ3o5x2zo30po9tW1sYbvYlvZmzSGi/ZFIW/yQ/BeUPKGxu3qwFi5iZfvnxUmDCdlyFR2eTrk4WMq4pMaMqq8sni48jzB4EshhuPOxbgeryRgon2AHAj3Az5hW71sF7IaRXNiYUiRiLb2jtIFVe/itaqfeCOXZL6uoYhmGzFM3WxoMXTmPaIBBoVoRPq1u81zzSliskvsJcVFpxL2z9yllJTfVOKXIRjW8EYU1V8NZt+G/pRVKyJu1LvvoUPdMI4p2MBBzmG0lvdXarybhPaotUwiP5cwT0Mu2Sbb0rIkw==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Thu, 28 Aug 2025 15:24:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 8/28/25 05:39, Dmytro Prokopchuk1 wrote:
> Fix an issue in the 'fail:' cleanup path of the 'assign_shared_memory()'
> function where the use of an unsigned long 'i' with the condition
> '--i >= 0' caused an infinite loop.

I'm not requesting any changes to this patch, but as a separate discussion this
could have been caught with -Wtype-limits:

arch/arm/static-shmem.c: In function ‘assign_shared_memory’:
arch/arm/static-shmem.c:188:17: warning: comparison of unsigned expression in 
‘>= 0’ is always true [-Wtype-limits]
  188 |     while ( --i >= 0 )
      |                 ^~

It might be nice to add this warning flag into the build by default, but there
may be other issues that would need to be addressed first. Having the flag at
least for the release build would be nice, since the debug build may (or may
not) have justifiable occurrences inside of ASSERTs. Again, I don't mean to
increase the scope of work, I'm just making an observation.

If you're curious try it out, add this to your make command:
EXTRA_CFLAGS_XEN_CORE="-Wtype-limits -Wno-error=type-limits"



 


Rackspace

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