* [bug report] crypto: chcr - Select device in Round Robin fashion
@ 2017-07-20 10:32 Dan Carpenter
2017-07-25 4:42 ` Harsh Jain
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-07-20 10:32 UTC (permalink / raw)
To: harsh; +Cc: linux-crypto
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.
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] crypto: chcr - Select device in Round Robin fashion
2017-07-20 10:32 [bug report] crypto: chcr - Select device in Round Robin fashion Dan Carpenter
@ 2017-07-25 4:42 ` Harsh Jain
0 siblings, 0 replies; 2+ messages in thread
From: Harsh Jain @ 2017-07-25 4:42 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-crypto
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-25 4:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox