[Bugs] [Bug 1503405] New: Potential use of NULL `this` variable before it gets initialization

bugzilla at redhat.com bugzilla at redhat.com
Wed Oct 18 03:50:42 UTC 2017


            Bug ID: 1503405
           Summary: Potential use of NULL `this` variable before it gets
           Product: GlusterFS
           Version: 3.10
         Component: changelog
          Severity: low
          Assignee: bugs at gluster.org
          Reporter: alexc at sbrella.com
                CC: bugs at gluster.org

Description of problem:

Our code scanner has reported a potential null pointer dereference at

        xlator_t                       *this                    = NULL;

        pthread_attr_t attr;

        ret = pthread_attr_init (&attr);
        if (ret != 0) {
                gf_msg (this->name, GF_LOG_ERROR, errno,    // <== `this`
variable is still NULL at this time. 
                        "Pthread init failed");
                return -1;

        this = THIS;  // `this` variable gets assignment here, it was NULL
before that
        if (!this) {
                ret = -1;
                goto out;

according to the documentation of pthread_attr_init, the chance of its
invocation failure is low, but once happened, the process will crash (the GEO
replication syncdaemon seems using this function).

Alex, SourceBrella Inc.

You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

More information about the Bugs mailing list