mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	net: atm: Use IS_ENABLED in atm_dev_ioctl
When building with -Wsometimes-uninitialized, Clang warns: net/atm/resources.c:256:6: warning: variable 'number' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] net/atm/resources.c:212:7: warning: variable 'iobuf_len' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] Clang won't realize that compat is 0 when CONFIG_COMPAT is not set until the constant folding stage, which happens after this semantic analysis. Use IS_ENABLED instead so that the zero is present at the semantic analysis stage, which eliminates this warning. Link: https://github.com/ClangBuiltLinux/linux/issues/386 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									3499e87ea0
								
							
						
					
					
						commit
						f9d19a7494
					
				
					 1 changed files with 2 additions and 6 deletions
				
			
		| 
						 | 
					@ -203,13 +203,9 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
 | 
				
			||||||
	int __user *sioc_len;
 | 
						int __user *sioc_len;
 | 
				
			||||||
	int __user *iobuf_len;
 | 
						int __user *iobuf_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef CONFIG_COMPAT
 | 
					 | 
				
			||||||
	compat = 0; /* Just so the compiler _knows_ */
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch (cmd) {
 | 
						switch (cmd) {
 | 
				
			||||||
	case ATM_GETNAMES:
 | 
						case ATM_GETNAMES:
 | 
				
			||||||
		if (compat) {
 | 
							if (IS_ENABLED(CONFIG_COMPAT) && compat) {
 | 
				
			||||||
#ifdef CONFIG_COMPAT
 | 
					#ifdef CONFIG_COMPAT
 | 
				
			||||||
			struct compat_atm_iobuf __user *ciobuf = arg;
 | 
								struct compat_atm_iobuf __user *ciobuf = arg;
 | 
				
			||||||
			compat_uptr_t cbuf;
 | 
								compat_uptr_t cbuf;
 | 
				
			||||||
| 
						 | 
					@ -253,7 +249,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (compat) {
 | 
						if (IS_ENABLED(CONFIG_COMPAT) && compat) {
 | 
				
			||||||
#ifdef CONFIG_COMPAT
 | 
					#ifdef CONFIG_COMPAT
 | 
				
			||||||
		struct compat_atmif_sioc __user *csioc = arg;
 | 
							struct compat_atmif_sioc __user *csioc = arg;
 | 
				
			||||||
		compat_uptr_t carg;
 | 
							compat_uptr_t carg;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue