netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Suggestion] net/core: cpumask_scnprintf, use (PAGE_SIZE - 1) instead of PAGE_SIZE
@ 2012-11-21  7:55 Chen Gang
  2012-11-21  8:02 ` Chen Gang
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang @ 2012-11-21  7:55 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-21  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21  7:55 [Suggestion] net/core: cpumask_scnprintf, use (PAGE_SIZE - 1) instead of PAGE_SIZE Chen Gang
2012-11-21  8:02 ` Chen Gang
2012-11-21  8:07   ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).