Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336733

[PATCH] rose: correct integer overflow check

From Insu Yun <wuninsu@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] rose: correct integer overflow check
Date 2016-02-17 21:30 +0100
Message-ID <r3gTw-36M-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Since rose_ndevs is signed integer type,
it can be overflowed when it is negative.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 net/rose/af_rose.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 129d357..4f37fae 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1514,7 +1514,8 @@ static int __init rose_proto_init(void)
 	int i;
 	int rc;
 
-	if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) {
+	if (rose_ndevs < 0 ||
+	    rose_ndevs > 0x7FFFFFFF / sizeof(struct net_device *)) {
 		printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n");
 		rc = -EINVAL;
 		goto out;
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] rose: correct integer overflow check Insu Yun <wuninsu@gmail.com> - 2016-02-17 21:30 +0100
  Re: [PATCH] rose: correct integer overflow check David Miller <davem@davemloft.net> - 2016-02-18 21:40 +0100
    Re: [PATCH] rose: correct integer overflow check Ralf Baechle <ralf@linux-mips.org> - 2016-02-19 01:00 +0100

csiph-web