public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Prasanna Meda <pmeda@akamai.com>
To: Prasanna Meda <pmeda@akamai.com>
Cc: akpm@osdl.org
Subject: Re: One more get_task_comm()
Date: Wed, 17 Nov 2004 14:11:20 -0800	[thread overview]
Message-ID: <419BCC88.D26B96AE@akamai.com> (raw)
In-Reply-To: 419BC8CF.424232E6@akamai.com


Removing assumption of  command length as 16 completely

--- arch/mips/kernel/sysirix.c.saved    Wed Nov 17 13:18:50 2004
+++ arch/mips/kernel/sysirix.c  Wed Nov 17 14:09:12 2004
@@ -282,9 +282,9 @@
                int pid = (int) regs->regs[base + 5];
                char *buf = (char *) regs->regs[base + 6];
                struct task_struct *p;
-               char comm[16];
+               char tcomm[sizeof(current->comm)];

-               retval = verify_area(VERIFY_WRITE, buf, 16);
+               retval = verify_area(VERIFY_WRITE, buf, sizeof(tcomm));
                if (retval)
                        break;
                read_lock(&tasklist_lock);
@@ -294,11 +294,11 @@
                        retval = -ESRCH;
                        break;
                }
-               memcpy(comm, p->comm, 16);
+               get_task_comm(tcomm, p);
                read_unlock(&tasklist_lock);

                /* XXX Need to check sizes. */
-               copy_to_user(buf, p->comm, 16);
+               copy_to_user(buf, tcomm, sizeof(tcomm));
                retval = 0;
                break;
        }


  reply	other threads:[~2004-11-17 21:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 21:55 One more get_task_comm() Prasanna Meda
2004-11-17 22:11 ` Prasanna Meda [this message]
2004-11-17 22:14 ` Prasanna Meda

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=419BCC88.D26B96AE@akamai.com \
    --to=pmeda@akamai.com \
    --cc=akpm@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox