Skip to content

Commit

Permalink
atm: Use kasprintf
Browse files Browse the repository at this point in the history
Use kasprintf in atm_proc_dev_register()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Mar 22, 2010
1 parent 283f2fe commit 62c97ac
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions net/atm/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,24 +406,16 @@ EXPORT_SYMBOL(atm_proc_root);

int atm_proc_dev_register(struct atm_dev *dev)
{
int digits, num;
int error;

/* No proc info */
if (!dev->ops->proc_read)
return 0;

error = -ENOMEM;
digits = 0;
for (num = dev->number; num; num /= 10)
digits++;
if (!digits)
digits++;

dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL);
dev->proc_name = kasprintf(GFP_KERNEL, "%s:%d", dev->type, dev->number);
if (!dev->proc_name)
goto err_out;
sprintf(dev->proc_name, "%s:%d", dev->type, dev->number);

dev->proc_entry = proc_create_data(dev->proc_name, 0, atm_proc_root,
&proc_atm_dev_ops, dev);
Expand Down

0 comments on commit 62c97ac

Please sign in to comment.