Bug 622903 - fix coverity Defect Type: Code maintainability issues
fix coverity Defect Type: Code maintainability issues
Status: CLOSED CURRENTRELEASE
Product: 389
Classification: Community
Component: Directory Server (Show other bugs)
1.2.6
All Linux
low Severity medium
: ---
: ---
Assigned To: Noriko Hosoi
Chandrasekar Kannan
http://10.16.47.145:8080/defects/inde...
:
Depends On:
Blocks: 389_1.2.7 639035
  Show dependency treegraph
 
Reported: 2010-08-10 14:22 EDT by Noriko Hosoi
Modified: 2015-01-04 18:43 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-05-17 10:08:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
git patch file (master) (1.01 KB, patch)
2010-08-10 14:34 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.01 KB, patch)
2010-08-10 14:50 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.57 KB, patch)
2010-08-10 15:06 EDT, Noriko Hosoi
no flags Details | Diff
git patch file (master) (2.20 KB, patch)
2010-08-10 16:05 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (969 bytes, text/plain)
2010-08-10 16:07 EDT, Noriko Hosoi
no flags Details
git patch file (master) (3.18 KB, patch)
2010-08-10 16:24 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.31 KB, patch)
2010-08-10 16:42 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.79 KB, patch)
2010-08-10 17:01 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.40 KB, patch)
2010-08-10 18:29 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.57 KB, patch)
2010-08-10 18:43 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.64 KB, patch)
2010-08-10 18:57 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.12 KB, patch)
2010-08-10 19:57 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.86 KB, patch)
2010-08-10 20:08 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.33 KB, patch)
2010-08-10 20:27 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (882 bytes, patch)
2010-08-10 21:14 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (1.15 KB, patch)
2010-08-11 13:22 EDT, Noriko Hosoi
nkinder: review+
Details | Diff
git patch file (master) (3.05 KB, patch)
2010-08-11 13:51 EDT, Noriko Hosoi
nkinder: review+
Details | Diff

  None (edit)
Description Noriko Hosoi 2010-08-10 14:22:10 EDT
Description of problem:
fix coverity Defect Type: Code maintainability issues
Comment 1 Noriko Hosoi 2010-08-10 14:34:01 EDT
Created attachment 437967 [details]
git patch file (master)

Comment:
The str assignment on line 1240 can be removed because the value
is not needed or will be overwritten.
Comment 2 Noriko Hosoi 2010-08-10 14:43:20 EDT
(In reply to comment #1)
> Created an attachment (id=437967) [details]
> git patch file (master)
> 
> Comment:
> The str assignment on line 1240 can be removed because the value
> is not needed or will be overwritten.    

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12248&streamDefectId=12434&defectInstanceId=14324&fileInstanceId=49281
Comment 3 Noriko Hosoi 2010-08-10 14:50:01 EDT
Created attachment 437971 [details]
git patch file (master)

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12249&streamDefectId=12435&defectInstanceId=14325&fileInstanceId=49281

Comment:
The call to strchr() is unnecessary because strcpy() will ensure
that string p is NULL-terminated.

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12250&streamDefectId=12436&defectInstanceId=14326&fileInstanceId=49281

Comment:
The call to strchr() is unnecessary because strcpy() will ensure
that string p is NULL-terminated.
Comment 4 Noriko Hosoi 2010-08-10 15:06:35 EDT
Created attachment 437974 [details]
git patch file (master)

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12251&streamDefectId=12437&defectInstanceId=14327&fileInstanceId=49278

Comment:
The "word" assignment on line 961 and 963 is unnecessary because
the value will be overwritten.

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12252&streamDefectId=12438&defectInstanceId=14329&fileInstanceId=49278

Comment:
The "s" assignments on line 271, 280, and 281 are unnecessary
because the value is never used.
Comment 5 Noriko Hosoi 2010-08-10 16:02:57 EDT
Comment on attachment 437974 [details]
git patch file (master)

Wrong attachment
Comment 6 Noriko Hosoi 2010-08-10 16:05:22 EDT
Created attachment 437988 [details]
git patch file (master)

git patch file (master)

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12251&streamDefectId=12437&defectInstanceId=14327&fileInstanceId=49278

Comment:
The "word" assignment on line 961 and 963 is unnecessary because
the value will be overwritten.

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12252&streamDefectId=12438&defectInstanceId=14329&fileInstanceId=49278

Comment:
The "s" assignments on line 271, 280, and 281 are unnecessary
because the value is never used.
Comment 7 Noriko Hosoi 2010-08-10 16:07:27 EDT
Created attachment 437989 [details]
git patch file (master)

http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12253&streamDefectId=12439&defectInstanceId=14332&fileInstanceId=49208

Comment:
The result of PR_HashTableAdd() should be checked for NULL value.
Comment 8 Noriko Hosoi 2010-08-10 16:24:43 EDT
Created attachment 437992 [details]
git patch file (master)

12254
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12254&streamDefectId=12440&defectInstanceId=14333&fileInstanceId=49276
Comment:
The "ptr" assignment on line 2622 is unnecessary because the value is never used.

12255
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12255&streamDefectId=12441&defectInstanceId=14334&fileInstanceId=49276
Comment:
The "word" assignment on line 2630 can be removed because the first token is ignored. Alternatively the value should be validated.

12256
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12256&streamDefectId=12442&defectInstanceId=14335&fileInstanceId=49276
Comment:
The "ptr" assignment on line 1456 is unnecessary because the value is not used.

12257
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12257&streamDefectId=12443&defectInstanceId=14336&fileInstanceId=49276
Comment:
The "word" assignment on line 1463 can be removed because the first token is ignored. Alternatively the value should be validated.

12258
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12258&streamDefectId=12444&defectInstanceId=14337&fileInstanceId=49276
Comment:
The "ptr" assignment on line 1210 is unnecessary because the value is never used.

12259
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12259&streamDefectId=12445&defectInstanceId=14338&fileInstanceId=49276
Comment:
The "word" assignment on line 1217 can be removed because the first token is ignored. Alternatively the value should be validated.
Comment 9 Noriko Hosoi 2010-08-10 16:42:26 EDT
Created attachment 437996 [details]
git patch file (master)

12260
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12260&streamDefectId=12446&defectInstanceId=14339&fileInstanceId=49364

Comment:
The "bval" assignment on line 636 can be removed because any value is accepted.
Note: This is to set debug mode "cb_set_debug(1)" which is enabled by having nsDebug in the chaining config entry.
Comment 10 Noriko Hosoi 2010-08-10 17:01:00 EDT
Created attachment 438002 [details]
git patch file (master)

12261
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12261&streamDefectId=12447&defectInstanceId=14340&fileInstanceId=49519

Comment:
Pointer "replica" returned by "object_get_data(prp->replica_object)" (line 826) is never used.
In "case STATE_READY_TO_ACQUIRE", Replica object "replica" is not needed.
Comment 11 Noriko Hosoi 2010-08-10 18:29:19 EDT
Created attachment 438016 [details]
git patch file (master)

12262
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12262&streamDefectId=12448&defectInstanceId=14341&fileInstanceId=49526

Comment:
The return value from object_get_data is assigend to ruv just
to check if repl_ruv object exists or not with PR_ASSERT in
the DEBUG mode (line 218).  Passing the object_get_data call
to PR_ASSERT directly.
Comment 12 Noriko Hosoi 2010-08-10 18:43:39 EDT
Created attachment 438018 [details]
git patch file (master)

12263
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12263&streamDefectId=12449&defectInstanceId=14342&fileInstanceId=49541

Comment:
Pointer "replica" returned by "object_get_data(prp->replica_object)"
(line 502) is never used.  In "case STATE_READY_TO_ACQUIRE", Replica
object "replica" is not needed.
Comment 13 Noriko Hosoi 2010-08-10 18:57:59 EDT
Created attachment 438021 [details]
git patch file (master)

12264
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12264&streamDefectId=12450&defectInstanceId=14343&fileInstanceId=49587

Comment:
The "cn" assignment on line 221 can be removed because it is not needed.
Comment 14 Noriko Hosoi 2010-08-10 19:57:36 EDT
Created attachment 438029 [details]
git patch file (master)

12265
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12265&streamDefectId=12451&defectInstanceId=14344&fileInstanceId=49296

Comment:
Pointer "log_dir" returned by "dblayer_get_home_dir(li, NULL)" is never used (line 1492).
Removing the unnecessary else clause.
Comment 15 Noriko Hosoi 2010-08-10 20:08:48 EDT
Created attachment 438031 [details]
git patch file (master)

12266
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12266&streamDefectId=12452&defectInstanceId=14345&fileInstanceId=49321

Comment:
The "p" assignments on line 260, 264, and 268 can be removed because they are not needed.
Comment 16 Noriko Hosoi 2010-08-10 20:27:52 EDT
Created attachment 438034 [details]
git patch file (master)

12267
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12267&streamDefectId=12453&defectInstanceId=14348&fileInstanceId=49335

Comment:
Calling slapi_sdn_get_dn and assigning the return value to base is not needed.
Comment 17 Noriko Hosoi 2010-08-10 21:14:24 EDT
Created attachment 438042 [details]
git patch file (master)

12268
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12268&streamDefectId=12454&defectInstanceId=14349&fileInstanceId=49648

Comment:
Pointer "slapdFrontendConfig" returned by "init_config" is never used (line 244).
Comment 18 Noriko Hosoi 2010-08-11 13:22:14 EDT
Created attachment 438237 [details]
git patch file (master)

12269
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12269&streamDefectId=12455&defectInstanceId=14350&fileInstanceId=49809

Comment:
The "new_row" assignment on line 87 can be removed because it is
not needed.
Comment 19 Noriko Hosoi 2010-08-11 13:51:31 EDT
Created attachment 438247 [details]
git patch file (master)

12253
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12253&streamDefectId=12439&defectInstanceId=14332&fileInstanceId=49208

12270
http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12270&streamDefectId=12456&defectInstanceId=14351&fileInstanceId=49208

Comment:
The result of PR_HashTableAdd() should be checked for NULL value.
Applied the change to all the PR_HashTableAdd calls in this file
lib/libaccess/register.cpp.
Comment 20 Noriko Hosoi 2010-08-11 18:53:56 EDT
Reviewed by Nathan (Thank you!!!)

Pushed to master.

$ git push
Counting objects: 130, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (101/101), done.
Writing objects: 100% (102/102), 11.25 KiB, done.
Total 102 (delta 78), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   100785a..79e2e7d  master -> master

Note You need to log in before you can comment on or make changes to this bug.