mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	vsprintf: use WARN_ON_ONCE
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									efc03ecb9d
								
							
						
					
					
						commit
						2f30b1f9e1
					
				
					 1 changed files with 2 additions and 12 deletions
				
			
		|  | @ -1092,13 +1092,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | ||||||
| 
 | 
 | ||||||
| 	/* Reject out-of-range values early.  Large positive sizes are
 | 	/* Reject out-of-range values early.  Large positive sizes are
 | ||||||
| 	   used for unknown buffer sizes. */ | 	   used for unknown buffer sizes. */ | ||||||
| 	if (unlikely((int) size < 0)) { | 	if (WARN_ON_ONCE((int) size < 0)) | ||||||
| 		/* There can be only one.. */ |  | ||||||
| 		static char warn = 1; |  | ||||||
| 		WARN_ON(warn); |  | ||||||
| 		warn = 0; |  | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	str = buf; | 	str = buf; | ||||||
| 	end = buf + size; | 	end = buf + size; | ||||||
|  | @ -1544,13 +1539,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) | ||||||
| 
 | 
 | ||||||
| 	struct printf_spec spec = {0}; | 	struct printf_spec spec = {0}; | ||||||
| 
 | 
 | ||||||
| 	if (unlikely((int) size < 0)) { | 	if (WARN_ON_ONCE((int) size < 0)) | ||||||
| 		/* There can be only one.. */ |  | ||||||
| 		static char warn = 1; |  | ||||||
| 		WARN_ON(warn); |  | ||||||
| 		warn = 0; |  | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	str = buf; | 	str = buf; | ||||||
| 	end = buf + size; | 	end = buf + size; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Marcin Slusarz
						Marcin Slusarz