Am Donnerstag, 4. August 2016, 13:41:58 CEST schrieb Mat Martineau:

Hi Mat,

> > +
> > +long keyctl_dh_compute(struct keyctl_dh_params __user *params,
> > +                  char __user *buffer, size_t buflen,
> > +                  struct keyctl_kdf_params __user *kdf)
> > +{
> > +   struct keyctl_kdf_params kdfcopy;
> > +
> > +   if (!kdf)
> > +           return __keyctl_dh_compute(params, buffer, buflen, NULL);
> > +
> > +   if (copy_from_user(&kdfcopy, kdf, sizeof(kdfcopy)) != 0)
> > +           return -EFAULT;
> > +
> > +   return __keyctl_dh_compute(params, buffer, buflen, &kdfcopy);
> 
> I'd find this more readable if there was one call to __keyctl_dh_compute.

When trying to implement it, I think that it would even be more confusing, 
because we need a conditional in any case. Do you like

return __keyctl_dh_compute(params, buffer, buflen, (kdf) ? &kdfcopy : NULL);

better than the already presented code? Besides, this would now imply that we 
have two conditionals instead of one.

Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to