@@ -241,7 +241,7 @@ int vfs_getattr(const struct path *path, struct kstat *stat,
241241 int retval ;
242242
243243 retval = security_inode_getattr (path );
244- if (retval )
244+ if (unlikely ( retval ) )
245245 return retval ;
246246 return vfs_getattr_nosec (path , stat , request_mask , query_flags );
247247}
@@ -421,7 +421,7 @@ SYSCALL_DEFINE2(stat, const char __user *, filename,
421421 int error ;
422422
423423 error = vfs_stat (filename , & stat );
424- if (error )
424+ if (unlikely ( error ) )
425425 return error ;
426426
427427 return cp_old_stat (& stat , statbuf );
@@ -434,7 +434,7 @@ SYSCALL_DEFINE2(lstat, const char __user *, filename,
434434 int error ;
435435
436436 error = vfs_lstat (filename , & stat );
437- if (error )
437+ if (unlikely ( error ) )
438438 return error ;
439439
440440 return cp_old_stat (& stat , statbuf );
@@ -443,12 +443,13 @@ SYSCALL_DEFINE2(lstat, const char __user *, filename,
443443SYSCALL_DEFINE2 (fstat , unsigned int , fd , struct __old_kernel_stat __user * , statbuf )
444444{
445445 struct kstat stat ;
446- int error = vfs_fstat ( fd , & stat ) ;
446+ int error ;
447447
448- if (!error )
449- error = cp_old_stat (& stat , statbuf );
448+ error = vfs_fstat (fd , & stat );
449+ if (unlikely (error ))
450+ return error ;
450451
451- return error ;
452+ return cp_old_stat ( & stat , statbuf ) ;
452453}
453454
454455#endif /* __ARCH_WANT_OLD_STAT */
@@ -502,10 +503,12 @@ SYSCALL_DEFINE2(newstat, const char __user *, filename,
502503 struct stat __user * , statbuf )
503504{
504505 struct kstat stat ;
505- int error = vfs_stat ( filename , & stat ) ;
506+ int error ;
506507
507- if (error )
508+ error = vfs_stat (filename , & stat );
509+ if (unlikely (error ))
508510 return error ;
511+
509512 return cp_new_stat (& stat , statbuf );
510513}
511514
@@ -516,7 +519,7 @@ SYSCALL_DEFINE2(newlstat, const char __user *, filename,
516519 int error ;
517520
518521 error = vfs_lstat (filename , & stat );
519- if (error )
522+ if (unlikely ( error ) )
520523 return error ;
521524
522525 return cp_new_stat (& stat , statbuf );
@@ -530,21 +533,23 @@ SYSCALL_DEFINE4(newfstatat, int, dfd, const char __user *, filename,
530533 int error ;
531534
532535 error = vfs_fstatat (dfd , filename , & stat , flag );
533- if (error )
536+ if (unlikely ( error ) )
534537 return error ;
538+
535539 return cp_new_stat (& stat , statbuf );
536540}
537541#endif
538542
539543SYSCALL_DEFINE2 (newfstat , unsigned int , fd , struct stat __user * , statbuf )
540544{
541545 struct kstat stat ;
542- int error = vfs_fstat ( fd , & stat ) ;
546+ int error ;
543547
544- if (!error )
545- error = cp_new_stat (& stat , statbuf );
548+ error = vfs_fstat (fd , & stat );
549+ if (unlikely (error ))
550+ return error ;
546551
547- return error ;
552+ return cp_new_stat ( & stat , statbuf ) ;
548553}
549554#endif
550555
0 commit comments