[Devel] [PATCH RH7] disable high-order allocations warnings in slip driver

Vasily Averin vvs at virtuozzo.com
Wed Mar 3 13:28:38 MSK 2021


slip driver can trigger high-order allocations in sl_change_mtu(),
sl_alloc_bufs() and slhc_init().

https://jira.sw.ru/browse/PSBM-125232
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 drivers/net/slip/slhc.c |  4 ++--
 drivers/net/slip/slip.c | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
index 1252d9c726a7..e3d564b208eb 100644
--- a/drivers/net/slip/slhc.c
+++ b/drivers/net/slip/slhc.c
@@ -100,7 +100,7 @@ slhc_init(int rslots, int tslots)
 
 	if ( rslots > 0  &&  rslots < 256 ) {
 		size_t rsize = rslots * sizeof(struct cstate);
-		comp->rstate = kzalloc(rsize, GFP_KERNEL);
+		comp->rstate = kzalloc(rsize, GFP_KERNEL | __GFP_ORDER_NOWARN);
 		if (! comp->rstate)
 			goto out_free;
 		comp->rslot_limit = rslots - 1;
@@ -108,7 +108,7 @@ slhc_init(int rslots, int tslots)
 
 	if ( tslots > 0  &&  tslots < 256 ) {
 		size_t tsize = tslots * sizeof(struct cstate);
-		comp->tstate = kzalloc(tsize, GFP_KERNEL);
+		comp->tstate = kzalloc(tsize, GFP_KERNEL | __GFP_ORDER_NOWARN);
 		if (! comp->tstate)
 			goto out_free2;
 		comp->tslot_limit = tslots - 1;
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index 748e68fa2e34..b004abb014eb 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -153,14 +153,14 @@ static int sl_alloc_bufs(struct slip *sl, int mtu)
 	 */
 	if (len < 576 * 2)
 		len = 576 * 2;
-	rbuff = kmalloc(len + 4, GFP_KERNEL);
+	rbuff = kmalloc(len + 4, GFP_KERNEL | __GFP_ORDER_NOWARN);
 	if (rbuff == NULL)
 		goto err_exit;
-	xbuff = kmalloc(len + 4, GFP_KERNEL);
+	xbuff = kmalloc(len + 4, GFP_KERNEL | __GFP_ORDER_NOWARN);
 	if (xbuff == NULL)
 		goto err_exit;
 #ifdef SL_INCLUDE_CSLIP
-	cbuff = kmalloc(len + 4, GFP_KERNEL);
+	cbuff = kmalloc(len + 4, GFP_KERNEL | __GFP_ORDER_NOWARN);
 	if (cbuff == NULL)
 		goto err_exit;
 	slcomp = slhc_init(16, 16);
@@ -235,10 +235,10 @@ static int sl_realloc_bufs(struct slip *sl, int mtu)
 	if (len < 576 * 2)
 		len = 576 * 2;
 
-	xbuff = kmalloc(len + 4, GFP_ATOMIC);
-	rbuff = kmalloc(len + 4, GFP_ATOMIC);
+	xbuff = kmalloc(len + 4, GFP_ATOMIC | __GFP_ORDER_NOWARN);
+	rbuff = kmalloc(len + 4, GFP_ATOMIC | __GFP_ORDER_NOWARN);
 #ifdef SL_INCLUDE_CSLIP
-	cbuff = kmalloc(len + 4, GFP_ATOMIC);
+	cbuff = kmalloc(len + 4, GFP_ATOMIC | __GFP_ORDER_NOWARN);
 #endif
 
 
-- 
2.25.1



More information about the Devel mailing list