> Since you no longer modify *max anywhere in this function, why leave it
> a pointer?  Making it pass by value seems more logical at that point
> (and cleaner).
> 
> The only consumer which can make use of partial result is
> tpm_rng_read(), but that will now return zero unless the buffer is filled.
> 
> My suggestion would be to drop the pointer and instead return a positive
> result (number of bytes) if you read anything and a negative result
> (-errno) on error.

  Sounds good.  I'll make this change.

Kent

> That way, a caller which can only use an exact number of bytes should do:
> 
>       rv = tpm_get_random(chip, buf, size);
>       if (rv != size)
>               /* error! */
> 
> ... and tpm_rng_read() can do something smarter.
> 
>       -hpa
> 

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

Reply via email to