Skip to content
New issue

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

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

Already on GitHub? Sign in 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

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

No branches or pull requests

1 participant