public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Linda Xie <lxiep@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, scheel@us.ibm.com, wortman@us.ibm.com
Subject: Re: PATCPATCH -- add unlimited name lengths support to sysfs
Date: Wed, 17 Dec 2003 12:41:00 -0800	[thread overview]
Message-ID: <20031217204100.GA13305@kroah.com> (raw)
In-Reply-To: <3FE0BC4D.8080605@us.ltcfwd.linux.ibm.com>

On Wed, Dec 17, 2003 at 02:27:57PM -0600, Linda Xie wrote:
> Greg KH wrote:
> >On Tue, Dec 16, 2003 at 05:07:22PM -0600, Linda Xie wrote:
> >
> >>diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
> >>--- a/fs/sysfs/symlink.c	Sun Dec 14 21:19:29 2003
> >>+++ b/fs/sysfs/symlink.c	Sun Dec 14 21:19:29 2003
> >>@@ -42,7 +42,10 @@
> >>	struct kobject * p = kobj;
> >>	int length = 1;
> >>	do {
> >>-		length += strlen(p->name) + 1;
> >>+		if (p->k_name)
> >>+			length += strlen(p->k_name) + 1;
> >>+		else
> >>+			length += strlen(p->name) + 1;
> >
> >
> >Shouldn't this just be:
> >		length += strlen(kobject_name(p)) + 1;
> >
> 
> That is correct. But here is my concern: Some of the callers of 
> sysfs_create_link()
> set p->name instead of p->k_name. So for them, the length calculated 
> using kobject_name(p) will be incorrect. Correct me if I am wrong.

Well if a kobject only uses the .name field, .k_name will point to it
(see kobject_add()), so the kobject_name() call will work in the above
case (as it should always do.)  Actually that if (p->k_name) statement
will always be true because of this fact :)

This lets people like the edd driver which does:
	 snprintf(edev->kobj.name, EDD_DEVICE_NAME_SIZE, "int13_dev%02x", edd[i].device);
still work properly.  Ideally, callers like this should change to use
the kobject_set_name() function, but there's no rush.

thanks,

greg k-h

  reply	other threads:[~2003-12-17 20:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-16 23:07 PATCPATCH -- add unlimited name lengths support to sysfs Linda Xie
2003-12-16 23:14 ` Greg KH
2003-12-17 20:27   ` Linda Xie
2003-12-17 20:41     ` Greg KH [this message]
2003-12-18  2:23       ` Linda Xie
2004-02-02 23:26         ` Greg KH

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=20031217204100.GA13305@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lxiep@us.ibm.com \
    --cc=scheel@us.ibm.com \
    --cc=wortman@us.ibm.com \
    /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