Re: [PATCH] crypto: rsa - add a check for allocation failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 30, 2023 at 05:11:33PM +0800, Herbert Xu wrote:
> On Mon, Oct 30, 2023 at 12:02:59PM +0300, Dan Carpenter wrote:
> > Static checkers insist that the mpi_alloc() allocation can fail so add
> > a check to prevent a NULL dereference.  Small allocations like this
> > can't actually fail in current kernels, but adding a check is very
> > simple and makes the static checkers happy.
> > 
> > Fixes: 6637e11e4ad2 ("crypto: rsa - allow only odd e and restrict value in FIPS mode")
> > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > ---
> >  crypto/rsa.c | 2 ++
> >  1 file changed, 2 insertions(+)
> 
> Nack.  Please fix the static checker instead.

The checker is not wrong.  Kernel policy is that every allocation has
to be checked for failure.  In *current* kernels it won't but we have
discussed changing this so the policy makes sense.

I have tested this some years back and I don't think it's so infeasible
as people think to allow these allocations to fail.

regards,
dan carpenter




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux