Hello,

On Wed, 26 Apr 2023 16:32:28 +0900
Yuichiro NAITO <naito.yuich...@gmail.com> wrote:
> These 2 revisions of 'attr_val' and 'attr_thr' are different on this
> disk.
> The comment says that it's wrong vendor implementation but I can see
> 'smartctl' shows the attributes as follows. NetBSD's atactl doesn't
> see these 2 revisions are same but checks each checksum is valid.

The diff seems correct.

ok?

> diff --git a/sbin/atactl/atactl.c b/sbin/atactl/atactl.c
> index 85dfced8c9a..1f77460ce3d 100644
> --- a/sbin/atactl/atactl.c
> +++ b/sbin/atactl/atactl.c
> @@ -1657,13 +1657,11 @@ device_attr(int argc, char *argv[])
>       req.datalen = sizeof(attr_thr);
>       ata_command(&req);
> 
> -     if (attr_val.revision != attr_thr.revision) {
> -             /*
> -              * Non standard vendor implementation.
> -              * Return, since we don't know how to use this.
> -              */
> -             return;
> -     }
> +     if (smart_cksum((u_int8_t *)&attr_val, sizeof(attr_val)) != 0)
> +             errx(1, "Checksum mismatch (attr_val)");
> +
> +     if (smart_cksum((u_int8_t *)&attr_thr, sizeof(attr_thr)) != 0)
> +             errx(1, "Checksum mismatch (attr_thr)");
> 
>       attr = attr_val.attribute;
>       thr = attr_thr.threshold;
> 

Reply via email to