[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


https://bugzilla.redhat.com/show_bug.cgi?id=1503405

            Bug ID: 1503405
           Summary: Potential use of NULL `this` variable before it gets
                    initialization
           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
xlators/features/changelog/lib/src/gf-history-changelog.c

        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. 
                        CHANGELOG_LIB_MSG_PTHREAD_ERROR,
                        "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).

Regards,
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