Re: [PATCH 1/1] hfsplus: fix longname handling

From: Vyacheslav Dubeyko
Date: Tue Feb 25 2014 - 05:23:35 EST


On Tue, 2014-02-25 at 12:05 +0200, sougata santra wrote:

> return err;
> >> +
> >> + len = be16_to_cpu(key->cat.name.length);
> >> key->key_len = cpu_to_be16(6 + 2 * len);
> >
> > I think that maybe it is time to change hardcoded 6 on sensible named
> > constant. What do you think?
>
> I agree, although I think this should he done in a separate patch. Also
> there are other instances of hard-coding. We can clean them with a patch. ?
>

Yes, I think so too. It will be great.

> > 62
> > 63 ustrlen = be16_to_cpu(name->length);
> >
> > I suppose that it makes sense to check name->length here and return
> > error. We can check possible volume corruption here.
>
> I looked into it while writing the patch. I think this was already
> handled before. Please see. catalog.c#hfsplus_find_cat the only place it
> is called.
>
> {code}
> if (be16_to_cpu(tmp.thread.nodeName.length) > 255) {
> pr_err("catalog name length corrupted\n");
> return -EIO;
> }
> {code}
>

OK. I agree that my suggestion is not necessary.

Thanks,
Vyacheslav Dubeyko.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/