* [PATCH] ATA: fix a problem that ata port print_id is used uninitialized
@ 2009-07-30 1:11 Zhang Rui
2009-07-30 4:33 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Rui @ 2009-07-30 1:11 UTC (permalink / raw)
To: linux-ide; +Cc: Zhang, Rui, Tejun Heo
fix a problem that ata port print_id is used uninitialized.
port print_id is initialized in ata_host_register, but it's
used in ata_host_start.
Now move it to ata_host_start, before it's invoked for the first time.
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
drivers/ata/libata-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Index: linux-2.6/drivers/ata/libata-core.c
===================================================================
--- linux-2.6.orig/drivers/ata/libata-core.c
+++ linux-2.6/drivers/ata/libata-core.c
@@ -5963,6 +5963,8 @@ int ata_host_start(struct ata_host *host
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
+ host->ports[i]->print_id = ata_print_id++;
+
if (ap->ops->port_start) {
rc = ap->ops->port_start(ap);
if (rc) {
@@ -6107,10 +6109,6 @@ int ata_host_register(struct ata_host *h
for (i = host->n_ports; host->ports[i]; i++)
kfree(host->ports[i]);
- /* give ports names and add SCSI hosts */
- for (i = 0; i < host->n_ports; i++)
- host->ports[i]->print_id = ata_print_id++;
-
rc = ata_scsi_add_hosts(host, sht);
if (rc)
return rc;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ATA: fix a problem that ata port print_id is used uninitialized
2009-07-30 1:11 [PATCH] ATA: fix a problem that ata port print_id is used uninitialized Zhang Rui
@ 2009-07-30 4:33 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2009-07-30 4:33 UTC (permalink / raw)
To: Zhang Rui; +Cc: linux-ide
Zhang Rui wrote:
> fix a problem that ata port print_id is used uninitialized.
>
> port print_id is initialized in ata_host_register, but it's
> used in ata_host_start.
> Now move it to ata_host_start, before it's invoked for the first time.
>
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
The idea was to assign print_id after the port is pretty much
guaranteed to be registered successfully but doing it earlier
shouldn't harm anything really. So,
Acked-by: Tejun Heo <tj@kernel.org>
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-30 4:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30 1:11 [PATCH] ATA: fix a problem that ata port print_id is used uninitialized Zhang Rui
2009-07-30 4:33 ` Tejun Heo
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).