Re: [GIT] Digital signature library bugfix

From: Linus Torvalds
Date: Wed Sep 12 2012 - 01:38:39 EST


On Wed, Sep 12, 2012 at 11:34 AM, James Morris <jmorris@xxxxxxxxx> wrote:
>
> - if (!err && len == hlen)
> - err = memcmp(out2, h, hlen);
> + if (err || len != hlen) {
> + err = -EINVAL;
> + goto err;
> + }
> +
> + err = memcmp(out2, h, hlen);
>
> err:

Hmm. I'll pull, but this seems to drop the error return from
pkcs_1_v1_5_decode_emsa() and always replace it with -EINVAL.

Now, I didn't look, and maybe that's the only error that the decode
thing can return, but still, it looks bad.

Wouldn't it have been better to do instead

if (err)
goto err;
err = -EINVAL;
if (len != hlen)
goto err;

and not overwrite the 'err' return with EINVAL?

Linus
--
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/