Re: [PATCH] scatterlist: don't BUG when we can trivially return aproper error.

From: Andrew Morton
Date: Wed Nov 14 2012 - 17:30:41 EST


On Wed, 14 Nov 2012 17:15:44 -0500
Nick Bowler <nbowler@xxxxxxxxxxxxxxxx> wrote:

> > Unfortunately there is no EKERNELSCREWEDUP,
>
> Well, maybe we should add it! :P

Well. Given how frequently it will be used, it would need to be a much
shorter identifier. Perhaps "EEK". Or just "E".

> > so we usually use EINVAL.
>
> Fair enough. I will prepare v2. But perhaps EOPNOTSUPP would be a
> better fit?

I have queued a delta:

From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Subject: scatterlist-dont-bug-when-we-can-trivially-return-a-proper-error-fix

s/E2BIG/EINVAL/

Cc: Nick Bowler <nbowler@xxxxxxxxxxxxxxxx>
Cc: Maxim Levitsky <maximlevitsky@xxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

lib/scatterlist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN lib/scatterlist.c~scatterlist-dont-bug-when-we-can-trivially-return-a-proper-error-fix lib/scatterlist.c
--- a/lib/scatterlist.c~scatterlist-dont-bug-when-we-can-trivially-return-a-proper-error-fix
+++ a/lib/scatterlist.c
@@ -249,7 +249,7 @@ int __sg_alloc_table(struct sg_table *ta

#ifndef ARCH_HAS_SG_CHAIN
if (WARN_ON_ONCE(nents > max_ents))
- return -E2BIG;
+ return -EINVAL;
#endif

memset(table, 0, sizeof(*table));
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/