@@ -241,7 +241,7 @@ int vfs_getattr(const struct path *path, struct kstat *stat,
241
241
int retval ;
242
242
243
243
retval = security_inode_getattr (path );
244
- if (retval )
244
+ if (unlikely ( retval ) )
245
245
return retval ;
246
246
return vfs_getattr_nosec (path , stat , request_mask , query_flags );
247
247
}
@@ -421,7 +421,7 @@ SYSCALL_DEFINE2(stat, const char __user *, filename,
421
421
int error ;
422
422
423
423
error = vfs_stat (filename , & stat );
424
- if (error )
424
+ if (unlikely ( error ) )
425
425
return error ;
426
426
427
427
return cp_old_stat (& stat , statbuf );
@@ -434,7 +434,7 @@ SYSCALL_DEFINE2(lstat, const char __user *, filename,
434
434
int error ;
435
435
436
436
error = vfs_lstat (filename , & stat );
437
- if (error )
437
+ if (unlikely ( error ) )
438
438
return error ;
439
439
440
440
return cp_old_stat (& stat , statbuf );
@@ -443,12 +443,13 @@ SYSCALL_DEFINE2(lstat, const char __user *, filename,
443
443
SYSCALL_DEFINE2 (fstat , unsigned int , fd , struct __old_kernel_stat __user * , statbuf )
444
444
{
445
445
struct kstat stat ;
446
- int error = vfs_fstat ( fd , & stat ) ;
446
+ int error ;
447
447
448
- if (!error )
449
- error = cp_old_stat (& stat , statbuf );
448
+ error = vfs_fstat (fd , & stat );
449
+ if (unlikely (error ))
450
+ return error ;
450
451
451
- return error ;
452
+ return cp_old_stat ( & stat , statbuf ) ;
452
453
}
453
454
454
455
#endif /* __ARCH_WANT_OLD_STAT */
@@ -502,10 +503,12 @@ SYSCALL_DEFINE2(newstat, const char __user *, filename,
502
503
struct stat __user * , statbuf )
503
504
{
504
505
struct kstat stat ;
505
- int error = vfs_stat ( filename , & stat ) ;
506
+ int error ;
506
507
507
- if (error )
508
+ error = vfs_stat (filename , & stat );
509
+ if (unlikely (error ))
508
510
return error ;
511
+
509
512
return cp_new_stat (& stat , statbuf );
510
513
}
511
514
@@ -516,7 +519,7 @@ SYSCALL_DEFINE2(newlstat, const char __user *, filename,
516
519
int error ;
517
520
518
521
error = vfs_lstat (filename , & stat );
519
- if (error )
522
+ if (unlikely ( error ) )
520
523
return error ;
521
524
522
525
return cp_new_stat (& stat , statbuf );
@@ -530,21 +533,23 @@ SYSCALL_DEFINE4(newfstatat, int, dfd, const char __user *, filename,
530
533
int error ;
531
534
532
535
error = vfs_fstatat (dfd , filename , & stat , flag );
533
- if (error )
536
+ if (unlikely ( error ) )
534
537
return error ;
538
+
535
539
return cp_new_stat (& stat , statbuf );
536
540
}
537
541
#endif
538
542
539
543
SYSCALL_DEFINE2 (newfstat , unsigned int , fd , struct stat __user * , statbuf )
540
544
{
541
545
struct kstat stat ;
542
- int error = vfs_fstat ( fd , & stat ) ;
546
+ int error ;
543
547
544
- if (!error )
545
- error = cp_new_stat (& stat , statbuf );
548
+ error = vfs_fstat (fd , & stat );
549
+ if (unlikely (error ))
550
+ return error ;
546
551
547
- return error ;
552
+ return cp_new_stat ( & stat , statbuf ) ;
548
553
}
549
554
#endif
550
555
0 commit comments