Skip to content

livetree: Fix a comparison of integers with different signedness#187

Open
ukleinek wants to merge 1 commit into
dgibson:mainfrom
ukleinek:master
Open

livetree: Fix a comparison of integers with different signedness#187
ukleinek wants to merge 1 commit into
dgibson:mainfrom
ukleinek:master

Conversation

@ukleinek

@ukleinek ukleinek commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

On some architectures we have:

livetree.c: In function 'fixup_phandles':
livetree.c:1237:54: error: comparison of integer expressions of different signedness: 'long int' and 'unsigned int' [-Werror=sign-compare]
 1237 |                         if (offset < 0 || offset + 4 > p->val.len) {
      |                                                      ^
cc1: all warnings being treated as errors
make: *** [Makefile:307: livetree.o] Error 1

Fixes: a26ef64 ("Restore phandle references from fixups node")
Closes: #186

On some architectures we have:

	livetree.c: In function 'fixup_phandles':
	livetree.c:1237:54: error: comparison of integer expressions of different signedness: 'long int' and 'unsigned int' [-Werror=sign-compare]
	 1237 |                         if (offset < 0 || offset + 4 > p->val.len) {
	      |                                                      ^
	cc1: all warnings being treated as errors
	make: *** [Makefile:307: livetree.o] Error 1

Fixes: a26ef64 ("Restore phandle references from __fixups__ node")
Closes: dgibson#186
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
@ukleinek

Copy link
Copy Markdown
Contributor Author

BTW, gcc 15.2.0 on x86_64 is fine with the code, gcc 15.2.0 on armhf triggers this warning. I guess the relevant difference is that on x86_64 an unsigned long (64bit) is big enough to hold all values of an unsigned int (32bit), but on armhf (both 32 bit) it isn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ARM 1.8.1 compile issue.

1 participant