usb: fix unbound stack warning for inotify_watchfn
Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1457503640-31473-1-git-send-email-peterx@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
		
							parent
							
								
									e3d60bc7c6
								
							
						
					
					
						commit
						f34d57d359
					
				@ -433,12 +433,11 @@ static void inotify_watchfn(void *arg)
 | 
				
			|||||||
    MTPState *s = arg;
 | 
					    MTPState *s = arg;
 | 
				
			||||||
    ssize_t bytes;
 | 
					    ssize_t bytes;
 | 
				
			||||||
    /* From the man page: atleast one event can be read */
 | 
					    /* From the man page: atleast one event can be read */
 | 
				
			||||||
    int len = sizeof(struct inotify_event) + NAME_MAX + 1;
 | 
					 | 
				
			||||||
    int pos;
 | 
					    int pos;
 | 
				
			||||||
    char buf[len];
 | 
					    char buf[sizeof(struct inotify_event) + NAME_MAX + 1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (;;) {
 | 
					    for (;;) {
 | 
				
			||||||
        bytes = read(s->inotifyfd, buf, len);
 | 
					        bytes = read(s->inotifyfd, buf, sizeof(buf));
 | 
				
			||||||
        pos = 0;
 | 
					        pos = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (bytes <= 0) {
 | 
					        if (bytes <= 0) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user