All of lore.kernel.org
 help / color / mirror / Atom feed
From: dan.carpenter at oracle.com (Dan Carpenter)
Subject: [bug report] selftests: cgroup: add memory controller self-tests
Date: Thu, 17 May 2018 16:22:25 +0300	[thread overview]
Message-ID: <20180517132225.GA13289@mwanda> (raw)

Hello Roman Gushchin,

The patch a62213fe9b77: "selftests: cgroup: add memory controller
self-tests" from May 11, 2018, leads to the following static checker
warning:

	./tools/testing/selftests/cgroup/cgroup_util.c:62 cg_name()
	warn: variable dereferenced before check 'name' (see line 59)

./tools/testing/selftests/cgroup/cgroup_util.c
    57  char *cg_name(const char *root, const char *name)
    58  {
    59          size_t len = strlen(root) + strlen(name) + 2;
                                            ^^^^^^^^^^^^
    60          char *ret = malloc(len);
    61  
    62          if (name)
                    ^^^^
    63                  snprintf(ret, len, "%s/%s", root, name);
    64  
    65          return ret;
    66  }
    67  
    68  char *cg_name_indexed(const char *root, const char *name, int index)
    69  {
    70          size_t len = strlen(root) + strlen(name) + 10;
                                            ^^^^^^^^^^^^
    71          char *ret = malloc(len);
    72  
    73          if (name)
                    ^^^^
    74                  snprintf(ret, len, "%s/%s_%d", root, name, index);
    75  
    76          return ret;
    77  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: dan.carpenter@oracle.com (Dan Carpenter)
Subject: [bug report] selftests: cgroup: add memory controller self-tests
Date: Thu, 17 May 2018 16:22:25 +0300	[thread overview]
Message-ID: <20180517132225.GA13289@mwanda> (raw)
Message-ID: <20180517132225.z9HwooafxKPPBR99icif1byFFEPpq4CNvJ8b5QDTAr8@z> (raw)

Hello Roman Gushchin,

The patch a62213fe9b77: "selftests: cgroup: add memory controller
self-tests" from May 11, 2018, leads to the following static checker
warning:

	./tools/testing/selftests/cgroup/cgroup_util.c:62 cg_name()
	warn: variable dereferenced before check 'name' (see line 59)

./tools/testing/selftests/cgroup/cgroup_util.c
    57  char *cg_name(const char *root, const char *name)
    58  {
    59          size_t len = strlen(root) + strlen(name) + 2;
                                            ^^^^^^^^^^^^
    60          char *ret = malloc(len);
    61  
    62          if (name)
                    ^^^^
    63                  snprintf(ret, len, "%s/%s", root, name);
    64  
    65          return ret;
    66  }
    67  
    68  char *cg_name_indexed(const char *root, const char *name, int index)
    69  {
    70          size_t len = strlen(root) + strlen(name) + 10;
                                            ^^^^^^^^^^^^
    71          char *ret = malloc(len);
    72  
    73          if (name)
                    ^^^^
    74                  snprintf(ret, len, "%s/%s_%d", root, name, index);
    75  
    76          return ret;
    77  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2018-05-17 13:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17 13:22 dan.carpenter [this message]
2018-05-17 13:22 ` [bug report] selftests: cgroup: add memory controller self-tests Dan Carpenter
2018-05-17 15:56 ` guro
2018-05-17 15:56   ` Roman Gushchin
2018-06-26  9:03 dan.carpenter
2018-06-26  9:03 ` Dan Carpenter
2018-06-26 17:15 ` guro
2018-06-26 17:15   ` Roman Gushchin
2019-03-27  7:32 dan.carpenter
2019-03-27  7:32 ` Dan Carpenter
2019-03-27 22:24 ` guro
2019-03-27 22:24   ` Roman Gushchin
2019-03-27 22:50   ` shuah
2019-03-27 22:50     ` shuah
2019-03-28  2:58     ` guro
2019-03-28  2:58       ` Roman Gushchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180517132225.GA13289@mwanda \
    --to=unknown@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.