Skip to contentSkip to conversation

libata: Fix wrong HPA horkage

PATCH In review Ioannis Barkas 3 participants 4 messages Oct 13 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata: Fix wrong HPA horkage

Code wrongly filters disks by their serial numbers

Fixes 16c55b038033 (\libata: implement BROKEN_HPA horkage and apply it to affected drives")
---
 drivers/ata/libata-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-core.c +2 -2
index 59e87b987d..b23e1c3e4c 100644
@@ -4248,8 +4248,8 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
 
 	/* devices which puke on READ_NATIVE_MAX */
 	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_QUIRK_BROKEN_HPA },
-	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_QUIRK_BROKEN_HPA },
-	{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD3200JD-00KLB0", "08.05J08", ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD2500JD-00HBB0", "08.02D08", ATA_QUIRK_BROKEN_HPA },
 	{ "MAXTOR 6L080L4",	"A93.0500",	ATA_QUIRK_BROKEN_HPA },
 
 	/* this one allows HPA unlocking but fails IOs on the area */
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 3 lines · Ioannis Barkas

Code wrongly filters disks by their serial numbers

Fixes 16c55b038033 (\libata: implement BROKEN_HPA horkage and apply it to affected drives")

This should have been V2, as you have already send a patch for this.

Like we commented on your V1:
https://lore.kernel.org/linux-ide/[email protected]/

The Fixes tag is corrupted, there should be no backslash.

Quoted 12 lines
---
 drivers/ata/libata-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-core.c +0 -0
index 59e87b987d..b23e1c3e4c 100644

drivers/ata/libata-core.c static const struct ata_dev_quirks_entry __ata_dev_quirks[] = { · line 4252

Quoted 7 lines
drivers/ata/libata-core.c +2 -2
@@ -4248,8 +4248,8 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
 
 	/* devices which puke on READ_NATIVE_MAX */
 	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_QUIRK_BROKEN_HPA },
-	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_QUIRK_BROKEN_HPA },
-	{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD3200JD-00KLB0", "08.05J08", ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD2500JD-00HBB0", "08.02D08", ATA_QUIRK_BROKEN_HPA },

You need to explain why the previous FW revision in not correct.

I think the simplest thing here is to simply omit the FW version field, i.e. change it to NULL.

However, as pointed out by Sashiko on V1:
https://lore.kernel.org/linux-ide/[email protected]/

There is already a wildcarded entry:

    { "WDC WD3200JD-*",     NULL,   ATA_QUIRK_WD_BROKEN_LPM },

So you should probably drop the "WDC WD3200JD-00KLB0" entry, and modify the "WDC WD3200JD-*" entry to have quirks:
ATA_QUIRK_BROKEN_HPA | ATA_QUIRK_WD_BROKEN_LPM

Kind regards,
Niklas

maintainer
#2 lore raw
Quoted 11 lines · Niklas Cassel
Quoted 3 lines · Ioannis Barkas

Code wrongly filters disks by their serial numbers

Fixes 16c55b038033 (\libata: implement BROKEN_HPA horkage and apply it to affected drives")

This should have been V2, as you have already send a patch for this.

Like we commented on your V1:
https://lore.kernel.org/linux-ide/[email protected]/

The Fixes tag is corrupted, there should be no backslash.

Also please fix the patch title prefix. It should be:

ata: libata-core: Fix wrong HPA horkage

And the title could be more explicit as to what is "wrong".

Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer
#3 lore raw
In reply to Ioannis Barkas
Quoted 1 line · Ioannis Barkas

Code wrongly filters disks by their serial numbers

I assume you found this using LLM, so a better commit message is something like:

ata: libata-core: Remove BROKEN_HPA quirks that can never match

The ATA_QUIRK_BROKEN_HPA entries for "WDC WD3200JD-00KLB0" and "WDC WD2500JD-00HBB0" use "WD-WCAMR1130137" and "WD-WMAL71490727" as model_rev. These look like drive serial numbers. model_rev is matched against the firmware revision, which is at most ATA_ID_FW_REV_LEN (8) characters long, so these 15 character patterns without wildcards can never match. This has been the case since the entries were added in commit 16c55b038033 ("libata: implement BROKEN_HPA horkage and apply it to affected drives"), which compared the strings using strcmp().

The firmware revisions of the affected drives are not known. Matching on the model only would apply ATA_QUIRK_BROKEN_HPA to drives that have never had it, and these entries would then take precedence over the "WDC WD3200JD-*" and "WDC WD2500JD-*" entries that match the same drives. Remove the two entries instead.

No functional change.

Assisted-by LLM

i.e. I would simply let the patch drop these two entries, such that the existing wildcard entries are the only ones used.

Quoted 27 lines
Fixes 16c55b038033 (\libata: implement BROKEN_HPA horkage and apply it to affected drives")
---
 drivers/ata/libata-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-core.c +2 -2
index 59e87b987d..b23e1c3e4c 100644
@@ -4248,8 +4248,8 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = {
 
 	/* devices which puke on READ_NATIVE_MAX */
 	{ "HDS724040KLSA80",	"KFAOA20N",	ATA_QUIRK_BROKEN_HPA },
-	{ "WDC WD3200JD-00KLB0", "WD-WCAMR1130137", ATA_QUIRK_BROKEN_HPA },
-	{ "WDC WD2500JD-00HBB0", "WD-WMAL71490727", ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD3200JD-00KLB0", "08.05J08", ATA_QUIRK_BROKEN_HPA },
+	{ "WDC WD2500JD-00HBB0", "08.02D08", ATA_QUIRK_BROKEN_HPA },
 	{ "MAXTOR 6L080L4",	"A93.0500",	ATA_QUIRK_BROKEN_HPA },
 
 	/* this one allows HPA unlocking but fails IOs on the area */
Signature · 1 line
2.53.0