Bug 99201 - Redundant comparison '(0 != string)' is always 'true'
Summary: Redundant comparison '(0 != string)' is always 'true'
Status: NEW
Alias: None
Product: p11-glue
Classification: Unclassified
Component: p11-kit (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Stef Walter
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-26 12:36 UTC by Pankaj
Modified: 2017-01-02 08:54 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
rpc-message patch (594 bytes, text/plain)
2016-12-26 12:36 UTC, Pankaj
Details

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

Hi,
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);      
505
506         assert (!msg->signature || p11_rpc_message_verify_part (msg, "z"));
507
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.