Open
Conversation
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Spotted by valgrind: ==1728072== 1 errors in context 1 of 2: ==1728072== Syscall param write(buf) points to uninitialised byte(s) ==1728072== at 0x4F4E104: write (write.c:27) ==1728072== by 0x10BE8F: check_permissions (adaptivemmd.c:813) ==1728072== by 0x10CFC4: main (adaptivemmd.c:1361) ==1728072== Address 0x1ffefffdb3 is on thread 1's stack ==1728072== in frame oracle#1, created by check_permissions (adaptivemmd.c:790) ==1728072== Uninitialised value was created by a stack allocation ==1728072== at 0x10BD49: check_permissions (adaptivemmd.c:790) ==1728072== ==1728072== ==1728072== 5 errors in context 2 of 2: ==1728072== Conditional jump or move depends on uninitialised value(s) ==1728072== at 0x4C34D08: strlen (vg_replace_strmem.c:458) ==1728072== by 0x10BE75: check_permissions (adaptivemmd.c:813) ==1728072== by 0x10CFC4: main (adaptivemmd.c:1361) ==1728072== Uninitialised value was created by a stack allocation ==1728072== at 0x10BD49: check_permissions (adaptivemmd.c:790) ==1728072== ==1728072== ERROR SUMMARY: 6 errors from 2 contexts (suppressed: 0 from 0) Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Pointed out by clang analyzer. Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
$ CC=clang make
clang -c -o predict.o predict.c -I. -Wall -g
predict.c:223:146: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
log_info(2, "Consumption rate on node %d=%ld pages/msec, reclaim rate is %ld pages/msec, Free pages=%ld, low wmark=%ld, high wmark=%ld", nid, abs(m[0]), reclaim_rate, frag_vec[0].free_pages, low_wmark, high_wmark);
^
predict.c:223:146: note: use function 'llabs' instead
log_info(2, "Consumption rate on node %d=%ld pages/msec, reclaim rate is %ld pages/msec, Free pages=%ld, low wmark=%ld, high wmark=%ld", nid, abs(m[0]), reclaim_rate, frag_vec[0].free_pages, low_wmark, high_wmark);
^~~
llabs
./predict.h:79:25: note: expanded from macro 'log_info'
log_msg(LOG_INFO, __VA_ARGS__)
^
predict.c:227:8: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
/ abs(m[0]);
^
predict.c:227:8: note: use function 'llabs' instead
/ abs(m[0]);
^~~
llabs
predict.c:247:147: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
log_info(3, "Consumption rate on node %d=%ld pages/msec, reclaim rate is %ld pages/msec, Free pages=%ld, low wmark=%ld, high wmark=%ld", nid, abs(m[0]), reclaim_rate, frag_vec[0].free_pages, low_wmark, high_wmark);
^
predict.c:247:147: note: use function 'llabs' instead
log_info(3, "Consumption rate on node %d=%ld pages/msec, reclaim rate is %ld pages/msec, Free pages=%ld, low wmark=%ld, high wmark=%ld", nid, abs(m[0]), reclaim_rate, frag_vec[0].free_pages, low_wmark, high_wmark);
^~~
llabs
./predict.h:79:25: note: expanded from macro 'log_info'
log_msg(LOG_INFO, __VA_ARGS__)
^
3 warnings generated.
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Annotate log_msg with a format attribute and fix the resulting compiler warnings. Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Pointed out by clang analyzer. While at it, change the return type to void as it always returns 0 / no caller looks at it. Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
The parser used to break out of the zone parsing state when encountering a "pagesets" token, which is however not always present - use "protection:" instead. Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
|
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. |
Contributor
|
Please complete the Oracle Contribution Agreement for me to review and merge this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the zoneinfo parser leaves the "zone parsing" state encountering a "pagesets" token. This is however not always present, leading to the parser staying in the "zone parsing" state even when the zone and/or node change.
In addition to that, this MR also adds a number of small fixes spotted by compiling the code with clang, clang analyzer and running it under valgrind.