]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.36.2/kfifo-disable-__kfifo_must_check_helper.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.2 / kfifo-disable-__kfifo_must_check_helper.patch
CommitLineData
9f934a63
GKH
1From 52c5171214ff3327961d0ce0db7e8d2ce55004fd Mon Sep 17 00:00:00 2001
2From: Andrew Morton <akpm@linux-foundation.org>
3Date: Tue, 26 Oct 2010 14:21:19 -0700
4Subject: kfifo: disable __kfifo_must_check_helper()
5
6From: Andrew Morton <akpm@linux-foundation.org>
7
8commit 52c5171214ff3327961d0ce0db7e8d2ce55004fd upstream.
9
10This helper is wrong: it coerces signed values into unsigned ones, so code
11such as
12
13 if (kfifo_alloc(...) < 0) {
14 error
15 }
16
17will fail to detect the error.
18
19So let's disable __kfifo_must_check_helper() for 2.6.36.
20
21Cc: Randy Dunlap <randy.dunlap@oracle.com>
22Cc: Stefani Seibold <stefani@seibold.net>
23Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
24Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
25Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26
27---
28 include/linux/kfifo.h | 7 ++-----
29 1 file changed, 2 insertions(+), 5 deletions(-)
30
31--- a/include/linux/kfifo.h
32+++ b/include/linux/kfifo.h
33@@ -171,11 +171,8 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PT
34 }
35
36
37-static inline unsigned int __must_check
38-__kfifo_must_check_helper(unsigned int val)
39-{
40- return val;
41-}
42+/* __kfifo_must_check_helper() is temporarily disabled because it was faulty */
43+#define __kfifo_must_check_helper(x) (x)
44
45 /**
46 * kfifo_initialized - Check if the fifo is initialized