* [bug report] padata: simplify serialization mechanism
@ 2017-04-11 9:16 Dan Carpenter
2017-04-12 8:40 ` [PATCH] padata: get_next is never NULL Jason A. Donenfeld
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-04-11 9:16 UTC (permalink / raw)
To: steffen.klassert; +Cc: linux-crypto
Hello Steffen Klassert,
The patch 5f1a8c1bc724: "padata: simplify serialization mechanism"
from Jul 7, 2010, leads to the following static checker warning:
kernel/padata.c:243 padata_reorder()
warn: 'padata' is an error pointer or valid
kernel/padata.c
231 if (!spin_trylock_bh(&pd->lock))
232 return;
233
234 while (1) {
235 padata = padata_get_next(pd);
236
237 /*
238 * All reorder queues are empty, or the next object that needs
239 * serialization is parallel processed by another cpu and is
240 * still on it's way to the cpu's reorder queue, nothing to
241 * do for now.
242 */
243 if (!padata || PTR_ERR(padata) == -EINPROGRESS)
^^^^^^
The comments still say that we sometimes return NULL but we removed that
in 2010.
244 break;
245
246 /*
247 * This cpu has to do the parallel processing of the next
248 * object. It's waiting in the cpu's parallelization queue,
249 * so exit immediately.
250 */
251 if (PTR_ERR(padata) == -ENODATA) {
252 del_timer(&pd->timer);
253 spin_unlock_bh(&pd->lock);
254 return;
255 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] padata: get_next is never NULL 2017-04-11 9:16 [bug report] padata: simplify serialization mechanism Dan Carpenter @ 2017-04-12 8:40 ` Jason A. Donenfeld 2017-04-14 7:46 ` Steffen Klassert 0 siblings, 1 reply; 3+ messages in thread From: Jason A. Donenfeld @ 2017-04-12 8:40 UTC (permalink / raw) To: steffen.klassert, linux-crypto, dan.carpenter, linux-kernel Cc: Jason A. Donenfeld Per Dan's static checker warning, the code that returns NULL was removed in 2010, so this patch updates the comments and fixes the code assumptions. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> --- kernel/padata.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/kernel/padata.c b/kernel/padata.c index f1aef1639204..ac8f1e524836 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -154,8 +154,6 @@ EXPORT_SYMBOL(padata_do_parallel); * A pointer to the control struct of the next object that needs * serialization, if present in one of the percpu reorder queues. * - * NULL, if all percpu reorder queues are empty. - * * -EINPROGRESS, if the next object that needs serialization will * be parallel processed by another cpu and is not yet present in * the cpu's reorder queue. @@ -182,8 +180,6 @@ static struct padata_priv *padata_get_next(struct parallel_data *pd) cpu = padata_index_to_cpu(pd, next_index); next_queue = per_cpu_ptr(pd->pqueue, cpu); - padata = NULL; - reorder = &next_queue->reorder; spin_lock(&reorder->lock); @@ -235,12 +231,11 @@ static void padata_reorder(struct parallel_data *pd) padata = padata_get_next(pd); /* - * All reorder queues are empty, or the next object that needs - * serialization is parallel processed by another cpu and is - * still on it's way to the cpu's reorder queue, nothing to - * do for now. + * If the next object that needs serialization is parallel + * processed by another cpu and is still on it's way to the + * cpu's reorder queue, nothing to do for now. */ - if (!padata || PTR_ERR(padata) == -EINPROGRESS) + if (PTR_ERR(padata) == -EINPROGRESS) break; /* -- 2.12.2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] padata: get_next is never NULL 2017-04-12 8:40 ` [PATCH] padata: get_next is never NULL Jason A. Donenfeld @ 2017-04-14 7:46 ` Steffen Klassert 0 siblings, 0 replies; 3+ messages in thread From: Steffen Klassert @ 2017-04-14 7:46 UTC (permalink / raw) To: Jason A. Donenfeld; +Cc: linux-crypto, dan.carpenter, linux-kernel On Wed, Apr 12, 2017 at 10:40:19AM +0200, Jason A. Donenfeld wrote: > Per Dan's static checker warning, the code that returns NULL was removed > in 2010, so this patch updates the comments and fixes the code > assumptions. > > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> This looks ok, Acked-by: Steffen Klassert <steffen.klassert@secunet.com> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-14 7:46 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-04-11 9:16 [bug report] padata: simplify serialization mechanism Dan Carpenter 2017-04-12 8:40 ` [PATCH] padata: get_next is never NULL Jason A. Donenfeld 2017-04-14 7:46 ` Steffen Klassert
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).