From: Harsh Jain <Harsh@chelsio.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-crypto@vger.kernel.org
Subject: Re: [bug report] crypto: chcr - Select device in Round Robin fashion
Date: Tue, 25 Jul 2017 10:12:35 +0530 [thread overview]
Message-ID: <482b055f-3509-0b92-e255-e5118e04a367@chelsio.com> (raw)
In-Reply-To: <20170720103252.jrtckdbcnnsbf4v3@mwanda>
On 20-07-2017 16:02, Dan Carpenter wrote:
> Hello Harsh Jain,
>
> The patch 14c19b178a01: "crypto: chcr - Select device in Round Robin
> fashion" from Jun 15, 2017, leads to the following static checker
> warning:
>
> drivers/crypto/chelsio/chcr_core.c:163 chcr_uld_add()
> warn: overwrite may leak 'u_ctx'
>
> drivers/crypto/chelsio/chcr_core.c
> 152 static void *chcr_uld_add(const struct cxgb4_lld_info *lld)
> 153 {
> 154 struct uld_ctx *u_ctx;
> 155
> 156 /* Create the device and add it in the device list */
> 157 u_ctx = kzalloc(sizeof(*u_ctx), GFP_KERNEL);
> 158 if (!u_ctx) {
> 159 u_ctx = ERR_PTR(-ENOMEM);
> 160 goto out;
> 161 }
> 162 if (!(lld->ulp_crypto & ULP_CRYPTO_LOOKASIDE)) {
>
> Sure, we could move this check before the allocation, to prevent the
> leak but is -ENOMEM really the right error code? It feels like -EINVAL
> with a WARN_ON_ONCE() message would be better but I don't really
> understand this code.
Will fix both issues in next change set. Thanks.
>
> 163 u_ctx = ERR_PTR(-ENOMEM);
> 164 goto out;
> 165 }
> 166 u_ctx->lldi = *lld;
> 167 out:
> 168 return u_ctx;
> 169 }
>
> regards,
> dan carpenter
prev parent reply other threads:[~2017-07-25 4:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 10:32 [bug report] crypto: chcr - Select device in Round Robin fashion Dan Carpenter
2017-07-25 4:42 ` Harsh Jain [this message]
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=482b055f-3509-0b92-e255-e5118e04a367@chelsio.com \
--to=harsh@chelsio.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-crypto@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