mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	NFSv4.1: Convert open-coded array allocation calls to kmalloc_array()
For added overflow protection... Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
		
							parent
							
								
									d8ba1f9714
								
							
						
					
					
						commit
						a4f743a6bb
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -313,7 +313,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	args->devs = kmalloc(n * sizeof(*args->devs), GFP_KERNEL);
 | 
						args->devs = kmalloc_array(n, sizeof(*args->devs), GFP_KERNEL);
 | 
				
			||||||
	if (!args->devs) {
 | 
						if (!args->devs) {
 | 
				
			||||||
		status = htonl(NFS4ERR_DELAY);
 | 
							status = htonl(NFS4ERR_DELAY);
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
| 
						 | 
					@ -415,7 +415,7 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
 | 
				
			||||||
			     rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
 | 
								     rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
 | 
				
			||||||
		if (unlikely(p == NULL))
 | 
							if (unlikely(p == NULL))
 | 
				
			||||||
			goto out;
 | 
								goto out;
 | 
				
			||||||
		rc_list->rcl_refcalls = kmalloc(rc_list->rcl_nrefcalls *
 | 
							rc_list->rcl_refcalls = kmalloc_array(rc_list->rcl_nrefcalls,
 | 
				
			||||||
						sizeof(*rc_list->rcl_refcalls),
 | 
											sizeof(*rc_list->rcl_refcalls),
 | 
				
			||||||
						GFP_KERNEL);
 | 
											GFP_KERNEL);
 | 
				
			||||||
		if (unlikely(rc_list->rcl_refcalls == NULL))
 | 
							if (unlikely(rc_list->rcl_refcalls == NULL))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue