-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
NFS - Fixing Coverity issue (Dereference null return value) #1894
Conversation
CID 1430123 Fixing dereference null return value by checking the value returned by an allocating method Change-Id: I3fc18208fd4cec2db4b2b5d1f47ef7d7f1c9a4b3 updates: gluster#1060 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
5f62667
to
fcb81f7
Compare
@@ -1424,8 +1424,10 @@ nlm4svc_lock_cbk(call_frame_t *frame, void *cookie, xlator_t *this, | |||
ncf = nlm4_notify_init(cs); | |||
if (ncf) { | |||
ncf->frame = copy_frame(frame); | |||
ncf->frame->local = ncf; | |||
nlm4svc_send_granted(ncf); | |||
if(ncf->frame){ |
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.
I'd argue that if copy_frame() failed, something is really really bad - out of memory for example, and you need to bail out.
This does fix the coverity issue perhaps, but not the real issue.
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.
While fixing this issue I've looked how this kind of situation is handled throughout the code.
In most cases code the code is in the form of:
var = copy_frame(frame);
if (var == NULL) {
goto out;
}
Moreover, the method calling this one is ignoring the return value anyway (this probably needs to be fixed, but not in the scope of the Coverity fix as this fix will involve functional change)
/recheck smoke |
/run regression |
1 similar comment
/run regression |
@deepshikhaaa Can you please check this? |
You could just send another patch when you get to it. |
@itisravi this issue of clang-format not picking the proper changes is now fixed. gluster/build-jobs#63 I recommend not reverting, but to fix the particular file in another PR. |
@amarts Thanks for the fix! Yes another PR was what I was suggesting as well. |
Smoke tests verified PR gluster#1894 even though there was a clang issue present and the PR was merged. Smoke tests have been fixed so sending this PR to rectify the clang issue. Change-Id: I3df5d2c77d9f3dd1872f2f28824565d5f24d82ec updates: gluster#1060 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
CID 1430123
Fixing dereference null return value by checking the value returned by
an allocating method
Change-Id: I3fc18208fd4cec2db4b2b5d1f47ef7d7f1c9a4b3
updates: #1060
Signed-off-by: Barak Sason Rofman bsasonro@redhat.com