[LU-9829] wrong pointer dereference in libcfs/util/parser.c Created: 04/Aug/17  Updated: 13/Sep/18  Resolved: 17/Aug/17

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.11.0

Type: Bug Priority: Major
Reporter: Oleg Drokin Assignee: WC Triage
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

This is highleghted by newer gcc as in Fedora 26:

util/parser.c: In function Б─≤processБ─≥:
util/parser.c:199:28: error: comparison between pointer and zero character constant [-Werror=pointer-compare]
                 if ( *next == '\0' ) {
                            ^~
util/parser.c:199:22: note: did you mean to dereference the pointer?
                 if ( *next == '\0' ) {
                      ^
cc1: all warnings being treated as errors
make[4]: *** [autoMakefile:671: libcfsutil_a-parser.o] Error 1
make[4]: Leaving directory '/home/green/smt/git/lustre-release/libcfs/libcfs'

Apparently we really need to do double dereference on next.



 Comments   
Comment by Gerrit Updater [ 04/Aug/17 ]

Oleg Drokin (oleg.drokin@intel.com) uploaded a new patch: https://review.whamcloud.com/28358
Subject: LU-9829 lnet: Properly dereference string pointer
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 869e8f07a2178ca33b83da82439ad8bd77363fa8

Comment by Oleg Drokin [ 04/Aug/17 ]

Additionally there's a similar problem in lr_rsync_data():

                snprintf(cmd, PATH_MAX, "%s --inplace %s %s", rsync, info->src,
                        info->dest);
                lr_debug(DTRACE, "\t%s %s\n", cmd, info->tfid);
                status = system(cmd);
Comment by Gerrit Updater [ 17/Aug/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/28358/
Subject: LU-9829 lnet: Properly dereference string pointer
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 58c721a79b171f71862eb6a92f66f139689a747f

Comment by Peter Jones [ 17/Aug/17 ]

Landed for 2.11

Comment by Gerrit Updater [ 13/Sep/18 ]

Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33159
Subject: LU-9829 lnet: Properly dereference string pointer
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: cd343f94aa59c245ccc2cda3c684b9539b7135e0

Generated at Sat Feb 10 02:29:39 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.