-
Notifications
You must be signed in to change notification settings - Fork 169
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
Fix conditional order for setting net device param #360
Conversation
/cc @yarda |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems ok, definitely reasonable
The conditional for setting a net device parameter in TuneD has a wrong order where it can potentially try to first cast a string to int in a wrong manner and only then check if the value is a specific integer value. Upstream TuneD fix: redhat-performance/tuned#360 Resolves rhbz#1974277.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although unlikely it could still fail with traceback if there is different string returned than 'n/a'. Could you rewrite it to something more robust and more simple like e.g.:
if context == "channels" and str(dev_params[next(iter(d))]) in ["n/a", "0"]:
@yanirq, could you please merge the commits to one and force push? |
The conditional for setting a net device parameter has a faulty order where it can potentially try to first cast a string to int in a wrong manner and only then check if the value is a specific integer value. current order: 1. check if a net device has a combined channel containing 0 2. check if a net device has a combined channel containing 'n/a' fixed order: robust check to see if device parameter is either 0 or 'n/a' Signed-off-by: Yanir Quinn <yquinn@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
The conditional for setting a net device parameter in TuneD has a wrong order where it can potentially try to first cast a string to int in a wrong manner and only then check if the value is a specific integer value. Upstream TuneD fix: redhat-performance/tuned#360 Resolves rhbz#1974277.
The conditional for setting a net device parameter in TuneD has a wrong order where it can potentially try to first cast a string to int in a wrong manner and only then check if the value is a specific integer value. Upstream TuneD fix: redhat-performance/tuned#360 Resolves rhbz#1974277.
The conditional for setting a net device parameter in TuneD has a wrong order where it can potentially try to first cast a string to int in a wrong manner and only then check if the value is a specific integer value. Upstream TuneD fix: redhat-performance/tuned#360 Resolves rhbz#1974277.
The conditional for setting a net device parameter in TuneD has a wrong order where it can potentially try to first cast a string to int in a wrong manner and only then check if the value is a specific integer value. Upstream TuneD fix: redhat-performance/tuned#360 Resolves rhbz#1974277.
The conditional for setting a net device parameter has
a faulty order where it can potentially try to first cast a string to int
in a wrong manner and only then check if the value is a specific integer value.
current order:
fixed order:
robust check to see if device parameter is either 0 or 'n/a'
Signed-off-by: Yanir Quinn yquinn@redhat.com