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

ntp: Fixed undefined behavior of the shift operator #769

Closed
wants to merge 1 commit into from

Conversation

d06alexandrov
Copy link
Contributor

L_LINT macro is used with negative numbers (e.g L_LINT(time_freq, -MAXFREQ)) so it could cause undefined behavior.
So it should be similar to the L_RSHIFT(v, n) macro.

Signed-off-by: Dmitriy Alexandrov <d06alexandrov@gmail.com>
@emaste
Copy link
Member

emaste commented Jun 8, 2023

CC @cschuber

(gcc12 build failure in Cirrus-CI is due to PR271903 and can be ignored)

@cschuber
Copy link
Member

cschuber commented Jun 8, 2023

I can look at this.

freebsd-git pushed a commit that referenced this pull request Jun 9, 2023
L_LINT macro is used with negative numbers [i.e.
L_LINT(time_freq, -MAXFREQ)], it could cause undefined
behavior. It should be similar to the L_RSHIFT(v, n) macro.

MFC after:	2 weeks
Reviewed by:	cy
Pull Request:	#769
Signed-off-by: Dmitriy Alexandrov <d06alexandrov@gmail.com>
@cschuber
Copy link
Member

This has been committed in af9ce4e.

@cschuber cschuber closed this Jun 10, 2023
@emaste emaste added the merged label Jun 12, 2023
freebsd-git pushed a commit that referenced this pull request Jun 23, 2023
L_LINT macro is used with negative numbers [i.e.
L_LINT(time_freq, -MAXFREQ)], it could cause undefined
behavior. It should be similar to the L_RSHIFT(v, n) macro.

MFC after:	2 weeks
Reviewed by:	cy
Pull Request:	#769
Signed-off-by: Dmitriy Alexandrov <d06alexandrov@gmail.com>
(cherry picked from commit af9ce4e)
freebsd-git pushed a commit that referenced this pull request Jun 23, 2023
L_LINT macro is used with negative numbers [i.e.
L_LINT(time_freq, -MAXFREQ)], it could cause undefined
behavior. It should be similar to the L_RSHIFT(v, n) macro.

MFC after:	2 weeks
Reviewed by:	cy
Pull Request:	#769
Signed-off-by: Dmitriy Alexandrov <d06alexandrov@gmail.com>
(cherry picked from commit af9ce4e)
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Aug 12, 2023
L_LINT macro is used with negative numbers [i.e.
L_LINT(time_freq, -MAXFREQ)], it could cause undefined
behavior. It should be similar to the L_RSHIFT(v, n) macro.

MFC after:	2 weeks
Reviewed by:	cy
Pull Request:	freebsd/freebsd-src#769
Signed-off-by: Dmitriy Alexandrov <d06alexandrov@gmail.com>
c-mauderer pushed a commit to c-mauderer/rtems that referenced this pull request Jun 5, 2024
L_LINT macro is used with negative numbers [i.e.
L_LINT(time_freq, -MAXFREQ)], it could cause undefined
behavior. It should be similar to the L_RSHIFT(v, n) macro.

MFC after:	2 weeks
Reviewed by:	cy
Pull Request:	freebsd/freebsd-src#769
Signed-off-by: Dmitriy Alexandrov <d06alexandrov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants