Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
/src/papi_pfm_events.c:820 - If return value from the function load_preset_table is NULL, NULL variable notemap will be dereferenced in the function free_notes (line #835).
/src/ctests/do_loops.c:304 - Declaring variable "i" without initializer.
/src/ctests/do_loops.c:309 - Using uninitialized value "i" if argc<=1 .
/src/ctests/test_utils.c:813 - Comparing "hw_info" to null implies that "hw_info" might be null.
/src/ctests/test_utils.c:820 - Passing null variable "hw_info->model_string" to function "strcmp", which dereferences it.
Version-Release number of selected component (if applicable):
papi-4.3.1-2
Additional info:
These defects were not present in the previous version of package.
The array is zero'ed out before use in papi_pfm_events.c. Seems that static analysis tool is not following the man page that is a no-op. According to "man 3 free":
free() frees the memory space pointed to by ptr, which must have been
returned by a previous call to malloc(), calloc() or realloc(). Other-
wise, or if free(ptr) has already been called before, undefined behav-
ior occurs. If ptr is NULL, no operation is performed.
The remaining two things flagged by the static analysis tool are in the test routines and do not end up in the binary rpms. Patches have been sent to the upstream papi developers to fix /src/ctests/do_loops.c and /src/ctests/test_utils.c
However, it seems of limited utility to fix this particular set of issues in the RHEL rpm.
(In reply to comment #2)
> The array is zero'ed out before use in papi_pfm_events.c. Seems that static
> analysis tool is not following the man page that is a no-op. According to "man
> 3 free":
The tool does not care about man pages. It checks the code. Unless I am mistaken, the code is wrong. If load_preset_table() returns non-zero, you pass the NULL pointer to free_notes(), which is _not_ no-op.
Please explain how exactly is the situation above handled by the code.
You are correct. Have patches to address the problems found in the scans. The patch /src/ctests/do_loops.c and /src/ctests/test_utils.c has been accepted upstream. The upstream has signficantly changed for papi_pfm_events.c, so that patch won't be applicable to papi upstream.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
http://rhn.redhat.com/errata/RHBA-2011-1755.html