All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [Suggestion] net/core: cpumask_scnprintf, use (PAGE_SIZE - 1) instead of PAGE_SIZE
Date: Wed, 21 Nov 2012 15:55:20 +0800	[thread overview]
Message-ID: <50AC88E8.4040202@asianux.com> (raw)

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 

             reply	other threads:[~2012-11-21  7:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21  7:55 Chen Gang [this message]
2012-11-21  8:02 ` [Suggestion] net/core: cpumask_scnprintf, use (PAGE_SIZE - 1) instead of PAGE_SIZE Chen Gang
2012-11-21  8:07   ` Chen Gang

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=50AC88E8.4040202@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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.