Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

printf %x flag shall not sign extend #274

Open
qhuo opened this issue Oct 4, 2024 · 0 comments
Open

printf %x flag shall not sign extend #274

qhuo opened this issue Oct 4, 2024 · 0 comments

Comments

@qhuo
Copy link

qhuo commented Oct 4, 2024

The in kernel printf function (kernel/printf.c) appears to have a bug with the %x flag. It treats the argument as a signed number, and sign extends to 64 bit before printing.

So if I do printf("%x", 0xd00dfeed"), I got ffffffffd00dfeed, wheras the correct output should be d00dfeed.

I think we need a fix like this: qhuo@fdfe28f

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant