lkml.org 
[lkml]   [2009]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher
From
Date
On Thu, 2009-01-15 at 17:23 +0800, Herbert Xu wrote:
> On Thu, Jan 15, 2009 at 05:21:47PM +0800, Huang Ying wrote:
> > On Thu, 2009-01-15 at 16:47 +0800, Herbert Xu wrote:
> > > On Thu, Jan 15, 2009 at 04:28:33PM +0800, Huang Ying wrote:
> > > >
> > > > + tfm = crypto_alloc_ablkcipher(cryptd_alg_name, type, mask);
> > > > + BUG_ON(crypto_ablkcipher_tfm(tfm)->__crt_alg->cra_module !=
> > > > + THIS_MODULE);
> > >
> > > You need to check whether tfm is an error before dereferencing it.
> > > Also it's probably better to free the tfm and return an error rather
> > > than invoking BUG.
> >
> > Why do we need this check? Someone else may register cryptd template?
> > Which error number should be return? -EINVAL?
>
> -ENOMEM for example.

You mean something as follow:

if (crypto_ablkcipher_tfm(tfm)->__crt_alg->cra_module != THIS_MODULE)
return ERR_PTR(-ENOMEM);

I think -ENOMEM is not appropriate for this check.

Sorry for ask you same question twice. Why do we need this check? Some
other module may register cryptd template?

Best Regards,
Huang Ying
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2009-01-15 10:33    [W:0.356 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site