lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 21 Nov 2012 15:55:20 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	David Miller <davem@...emloft.net>
CC:	netdev <netdev@...r.kernel.org>
Subject: [Suggestion] net/core: cpumask_scnprintf, use (PAGE_SIZE - 1) instead
 of PAGE_SIZE

Hi David Miller:

in net/core/net-sysfs.c:

  at line 496, we need use (PAGE_SIZE -1) instead of PAGE_SIZE.
  since at line 505, we append '\n'.

  regard

gchen


 479 static ssize_t show_rps_map(struct netdev_rx_queue *queue,
 480                             struct rx_queue_attribute *attribute, char *buf)
 481 {
 482         struct rps_map *map;
 483         cpumask_var_t mask;
 484         size_t len = 0;
 485         int i;
 486 
 487         if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
 488                 return -ENOMEM;
 489 
 490         rcu_read_lock();
 491         map = rcu_dereference(queue->rps_map);
 492         if (map)
 493                 for (i = 0; i < map->len; i++)
 494                         cpumask_set_cpu(map->cpus[i], mask);
 495 
 496         len += cpumask_scnprintf(buf + len, PAGE_SIZE, mask);
 497         if (PAGE_SIZE - len < 3) {
 498                 rcu_read_unlock();
 499                 free_cpumask_var(mask);
 500                 return -EINVAL;
 501         }
 502         rcu_read_unlock();
 503 
 504         free_cpumask_var(mask);
 505         len += sprintf(buf + len, "\n");
 506         return len;
 507 }
 508 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists