> -----Original Message----- > From: Herbert Xu [mailto:herbert@xxxxxxxxxxxxxxxxxxx] > Sent: Tuesday, May 31, 2016 7:53 AM > To: Benedetto, Salvatore <salvatore.benedetto@xxxxxxxxx> > Cc: linux-crypto@xxxxxxxxxxxxxxx > Subject: Re: [PATCH v5 2/3] crypto: kpp - Add DH software implementation > > On Mon, May 09, 2016 at 10:40:40PM +0100, Salvatore Benedetto wrote: > > > > +static int dh_set_params(struct crypto_kpp *tfm, void *buffer, > > + unsigned int len) > > +{ > > + struct dh_ctx *ctx = dh_get_ctx(tfm); > > + struct dh_params *params = (struct dh_params *)buffer; > > + > > + if (unlikely(!buffer || !len)) > > + return -EINVAL; > > What's the point of len? It's never checked anywhere apart from this non- > zero check which is pointless. Just get rid of it. When I first created the API I thought it would be useful to validate the given buffer in case the user passed in the wrong structure. The actual check would have been If (unlikely(!len && len != sizeof(struct dh_params)) return -EINVAL; but I agree I don't see much value in that now. I'll remove it. Regards, Salvatore -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html