Merge tag 'tags/bcm2835-dt-fixes-2020-03-27' into devicetree/fixes
[linux-2.6-microblaze.git] / tools / perf / util / cpumap.c
index 983b738..dc5c5e6 100644 (file)
@@ -317,7 +317,7 @@ static void set_max_cpu_num(void)
 
        /* get the highest possible cpu number for a sparse allocation */
        ret = snprintf(path, PATH_MAX, "%s/devices/system/cpu/possible", mnt);
-       if (ret == PATH_MAX) {
+       if (ret >= PATH_MAX) {
                pr_err("sysfs path crossed PATH_MAX(%d) size\n", PATH_MAX);
                goto out;
        }
@@ -328,7 +328,7 @@ static void set_max_cpu_num(void)
 
        /* get the highest present cpu number for a sparse allocation */
        ret = snprintf(path, PATH_MAX, "%s/devices/system/cpu/present", mnt);
-       if (ret == PATH_MAX) {
+       if (ret >= PATH_MAX) {
                pr_err("sysfs path crossed PATH_MAX(%d) size\n", PATH_MAX);
                goto out;
        }
@@ -356,7 +356,7 @@ static void set_max_node_num(void)
 
        /* get the highest possible cpu number for a sparse allocation */
        ret = snprintf(path, PATH_MAX, "%s/devices/system/node/possible", mnt);
-       if (ret == PATH_MAX) {
+       if (ret >= PATH_MAX) {
                pr_err("sysfs path crossed PATH_MAX(%d) size\n", PATH_MAX);
                goto out;
        }
@@ -441,7 +441,7 @@ int cpu__setup_cpunode_map(void)
                return 0;
 
        n = snprintf(path, PATH_MAX, "%s/devices/system/node", mnt);
-       if (n == PATH_MAX) {
+       if (n >= PATH_MAX) {
                pr_err("sysfs path crossed PATH_MAX(%d) size\n", PATH_MAX);
                return -1;
        }
@@ -456,7 +456,7 @@ int cpu__setup_cpunode_map(void)
                        continue;
 
                n = snprintf(buf, PATH_MAX, "%s/%s", path, dent1->d_name);
-               if (n == PATH_MAX) {
+               if (n >= PATH_MAX) {
                        pr_err("sysfs path crossed PATH_MAX(%d) size\n", PATH_MAX);
                        continue;
                }