From 9acfb07b23a5bbd86cebbceb4aa96fee74f313ac Mon Sep 17 00:00:00 2001 From: Craig Small Date: Wed, 26 Oct 2011 22:25:21 +1100 Subject: [PATCH] pmap fix by Jim --- contrib/response.filtered-with-patches.err | 2 +- pmap.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/response.filtered-with-patches.err b/contrib/response.filtered-with-patches.err index ae6cda01..6d235e0a 100644 --- a/contrib/response.filtered-with-patches.err +++ b/contrib/response.filtered-with-patches.err @@ -61,7 +61,7 @@ pgrep.c:558: data_index: Using tainted variable "(int)argv[1][1]" as an index to Error: EVALUATION_ORDER: agree that there is a problem. moreover, it deals with an undocumented command line argument (but sami has documentation addition pending) - a deference was added in line with intent, hopefully avoids this warning + the logic was altered in line with intent, hopefully avoids this warning my_category: defect_was_fixed pmap.c:314: write_write_order: In "arg2 = (arg2 ? arg2++ : arg1)", "arg2" is written in "arg2" (the assignment left-hand side) and written in "arg2 ? arg2++ : arg1" but the order in which the side effects take place is undefined because there is no intervening sequence point. diff --git a/pmap.c b/pmap.c index 9fcaa2af..1df1a852 100644 --- a/pmap.c +++ b/pmap.c @@ -311,14 +311,15 @@ int main(int argc, char *argv[]){ char *arg2 = strchr(arg1,','); if(arg2) *arg2 = '\0'; - arg2 = *arg2 ? arg2++ : arg1; + if(arg2) ++arg2; + else arg2 = arg1; if(*arg1) range_low = STRTOUKL(arg1,&arg1,16); if(*arg2) range_high = STRTOUKL(arg2,&arg2,16); if(*arg1 || *arg2) - usage(); + usage(); } break; case 'a': // Sun prints anon/swap reservations