summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d00fb49)
If both `if (snprintf(...` of the `get_ns_inum()` function fail, the
function will not uninitialize the `ns_inum` output parameter and still
return 0. Leading to the argument `ns1` of debug_printf() being used
uninitialized.
Reported-by: scan-build.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I47286312095ca0f6a889eb0faa93661f92156ec1
static int get_ns_inum(const char *ns, ino_t *ns_inum)
{
static int get_ns_inum(const char *ns, ino_t *ns_inum)
{
struct stat sb;
char proc_ns_path[LTTNG_PROC_NS_PATH_MAX];
struct stat sb;
char proc_ns_path[LTTNG_PROC_NS_PATH_MAX];
"/proc/thread-self/ns/%s", ns) >= 0) {
if (stat(proc_ns_path, &sb) == 0) {
*ns_inum = sb.st_ino;
"/proc/thread-self/ns/%s", ns) >= 0) {
if (stat(proc_ns_path, &sb) == 0) {
*ns_inum = sb.st_ino;
"/proc/self/task/%d/%s/net", lttng_gettid(), ns) >= 0) {
if (stat(proc_ns_path, &sb) == 0) {
*ns_inum = sb.st_ino;
"/proc/self/task/%d/%s/net", lttng_gettid(), ns) >= 0) {
if (stat(proc_ns_path, &sb) == 0) {
*ns_inum = sb.st_ino;