Bug 99201

Summary: Redundant comparison '(0 != string)' is always 'true'
Product: p11-glue Reporter: Pankaj <pankaj.s01>
Component: p11-kitAssignee: Stef Walter <stefw>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium CC: ueno
Version: unspecified   
Hardware: Other   
OS: All   
i915 platform: i915 features:
Attachments: rpc-message patch

Description Pankaj 2016-12-26 12:36:19 UTC
Created attachment 128659 [details]
rpc-message patch

This is reported for redundant check for 'string' to be NULL at line +504 by assert() and at line +509 check for NULL . So Duplicate checks are not required at line +509 .So please review the attached patch :

Code snippet:
498 bool
499 p11_rpc_message_write_zero_string (p11_rpc_message *msg,
500                                    CK_UTF8CHAR *string)
501 {
502         assert (msg != NULL);
503         assert (msg->output != NULL);
504         assert (string != NULL);      
506         assert (!msg->signature || p11_rpc_message_verify_part (msg, "z"));
508         p11_rpc_buffer_add_byte_array (msg->output, string,
509                                        string ? strlen ((char *)string) :0);
510         return !p11_buffer_failed (msg->output);
511 }
Comment 1 Stef Walter 2017-01-02 08:54:06 UTC
Thanks Pankaj. Development has now moved to GitHub: https://github.com/p11-glue/p11-kit ... although I think we can work out getting this patch in from here.

Daiki, how should we handle patches in bugzilla? Do we want to close down the p11-kit stuff on the freedesktop.org bugzilla? If so I can put in a request ... it may take a while to actually have a sysadmin make the change.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.