Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Sebastian Siewior <linux-crypto@ml.breakpoint.cc>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher
Date: Thu, 15 Jan 2009 17:30:51 +0800	[thread overview]
Message-ID: <1232011851.5937.208.camel@yhuang-dev.sh.intel.com> (raw)
In-Reply-To: <20090115092314.GA32559@gondor.apana.org.au>

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-01-15  9:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15  8:28 [PATCH crypto -v4 1/2] AES-NI: Add support to access underlying blkcipher under cryptd ablkcipher Huang Ying
2009-01-15  8:47 ` Herbert Xu
2009-01-15  9:21   ` Huang Ying
2009-01-15  9:23     ` Herbert Xu
2009-01-15  9:30       ` Huang Ying [this message]
2009-01-15  9:49         ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1232011851.5937.208.camel@yhuang-dev.sh.intel.com \
    --to=ying.huang@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@ml.breakpoint.cc \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox