From: Mathieu Chouquet-Stringer <mchouque@free.fr>
To: Bob Tracy <rct@gherkin.frus.com>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
James.Bottomley@SteelEye.com, linux-alpha@vger.kernel.org
Subject: Re: class_device_add error in SCSI with 2.6.17-rc2-g52824b6b
Date: Thu, 20 Apr 2006 12:14:48 +0200 [thread overview]
Message-ID: <20060420101448.GA20087@localhost> (raw)
In-Reply-To: <20060419215803.6DE5BDBA1@gherkin.frus.com>
On Wed, Apr 19, 2006 at 04:58:03PM -0500, Bob Tracy wrote:
> Similar error previously reported by me for 2.6.17-rc1, except sda got
> added fine: error occurred when attempting to add/register sdb.
> Thankfully, you were able to append a trace...
In my case, I was able to solve the problem by replacing this call at
line 1648 in drivers/scsi/sd.c (patch attached):
strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
by
snprintf(sdkp->cdev.class_id, BUS_ID_SIZE, "%s", sdp->sdev_gendev.bus_id);
Then it works.
While debugging the whole thing, I was printk'ing the value of
sdkp->cdev.class_id right after the strncpy call and here's what I
getting (basically only the first 4 chars + final \0):
"0:0:"
So I guess the strncpy routine on alpha is fscked up or gcc is doing
something crazy. The function is under arch/alpha/lib/strncpy.S, time to
learn assembly.
--- linux-2.6/drivers/scsi/sd.c 2006-03-28 13:28:24.000000000 +0200
+++ linux-2.6-mat/drivers/scsi/sd.c 2006-04-20 12:12:36.000000000 +0200
@@ -1645,7 +1645,8 @@
class_device_initialize(&sdkp->cdev);
sdkp->cdev.dev = &sdp->sdev_gendev;
sdkp->cdev.class = &sd_disk_class;
- strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
+ snprintf(sdkp->cdev.class_id, BUS_ID_SIZE, "%s",
+ sdp->sdev_gendev.bus_id);
if (class_device_add(&sdkp->cdev))
goto out_put;
--
Mathieu Chouquet-Stringer mchouque@free.fr
"Le disparu, si l'on vénère sa mémoire, est plus présent et
plus puissant que le vivant".
-- Antoine de Saint-Exupéry, Citadelle --
-
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next parent reply other threads:[~2006-04-20 10:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060419213129.GA9148@localhost>
[not found] ` <20060419215803.6DE5BDBA1@gherkin.frus.com>
2006-04-20 10:14 ` Mathieu Chouquet-Stringer [this message]
2006-04-20 10:57 ` class_device_add error in SCSI with 2.6.17-rc2-g52824b6b Mathieu Chouquet-Stringer
2006-04-20 17:11 ` strncpy (maybe others) broken on Alpha Mathieu Chouquet-Stringer
2006-04-20 20:55 ` Mathieu Chouquet-Stringer
2006-04-20 21:24 ` Ivan Kokshaysky
2006-04-20 21:27 ` Mathieu Chouquet-Stringer
2006-04-20 21:40 ` Bob Tracy
2006-04-20 21:57 ` Mathieu Chouquet-Stringer
2006-04-21 2:43 ` Bob Tracy
2006-04-21 8:15 ` Mathieu Chouquet-Stringer
2006-04-21 9:21 ` Mathieu Chouquet-Stringer
2006-04-21 9:50 ` Mathieu Chouquet-Stringer
2006-04-21 11:41 ` Bob Tracy
2006-04-21 11:55 ` Mathieu Chouquet-Stringer
2006-04-21 14:22 ` Ivan Kokshaysky
2006-04-21 19:37 ` Bob Tracy
2006-04-21 21:12 ` Ivan Kokshaysky
2006-04-21 22:49 ` Bob Tracy
2006-04-22 8:47 ` Mathieu Chouquet-Stringer
2006-04-22 8:45 ` Mathieu Chouquet-Stringer
2006-04-22 10:39 ` Bryan Østergaard
2006-04-20 21:22 ` Ivan Kokshaysky
2006-04-20 21:25 ` Mathieu Chouquet-Stringer
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=20060420101448.GA20087@localhost \
--to=mchouque@free.fr \
--cc=James.Bottomley@SteelEye.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=rct@gherkin.frus.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;
as well as URLs for NNTP newsgroup(s).