Fix a gfs2 sign extension bug introduced in v4.3.

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJc5T3YAAoJENW/n+sDE2U6bk4P/2Va4yjgGVY4ZtL8341iyQGQ
 iAA7igZ/XlojNqNcI7zgjtDclqPLFmkikag2rxQFz4darGhv+D/+M/8UG2kKNPKy
 vFQsUlP8scjDCKh5QWcWXxAJpNMx66wPrkeWT1e8K3E7qoyaoMC7OqZsbnsdFjdN
 ObFxOvZtrdHvNpt0uRsSyvTeKVGILDmzc5oppZgomdDgLTFyfBO/IUI0GBhK67K1
 3MnX0x31IstCMyHzVcY4X4Xi1qTatALWYkYStk59ZG+ix0vqa/IYKW4DU6bboxhe
 2raoQJRy81RNsMa3NQhBfYbrXOyUNmuDOeq0SOsz+eQF7Z/ZCvtprJdTqxa3z2+K
 UwUVn/Zo8vAkQJG6r7QAjKoQckM+euWjtOP1O0vt71cUWYjuIXvZ9an4WlMaeVca
 qhSey0Y3AEFyPIdsU35lL5TXjT/iNOSNBjvz5uH92AnaSmsFkYkXjBn3YfZ7UXgo
 HCWJbusz3Ly0LQlnWYXcK7AgneVr5lTW9K9xnAncWxoeBgi6R8q5/U9qYqFrZYLr
 AAsoVJRs1mSFuP5YdD209ShUnrWcoluGihnN/0HwjXh1pwNakOOIlJ3GzCGdRZki
 OxAZZ8VJ36rFYG9tb8lKfvnp61JvpBNttDoIAXlYmD2GfGG2lcXRG2wcfxyTLv/9
 IBlOo5+Wzaa7ESt/7HHA
 =CVsA
 -----END PGP SIGNATURE-----

Merge tag 'gfs2-5.1.fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 fix from Andreas Gruenbacher:
 "Fix a gfs2 sign extension bug introduced in v4.3"

* tag 'gfs2-5.1.fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: Fix sign extension bug in gfs2_update_stats
This commit is contained in:
Linus Torvalds 2019-05-22 08:31:09 -07:00
Родитель f75b6f303b 5a5ec83d6a
Коммит 651bae980e
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -31,9 +31,10 @@
* @delta is the difference between the current rtt sample and the
* running average srtt. We add 1/8 of that to the srtt in order to
* update the current srtt estimate. The variance estimate is a bit
* more complicated. We subtract the abs value of the @delta from
* the current variance estimate and add 1/4 of that to the running
* total.
* more complicated. We subtract the current variance estimate from
* the abs value of the @delta and add 1/4 of that to the running
* total. That's equivalent to 3/4 of the current variance
* estimate plus 1/4 of the abs of @delta.
*
* Note that the index points at the array entry containing the smoothed
* mean value, and the variance is always in the following entry
@ -49,7 +50,7 @@ static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index,
s64 delta = sample - s->stats[index];
s->stats[index] += (delta >> 3);
index++;
s->stats[index] += ((abs(delta) - s->stats[index]) >> 2);
s->stats[index] += (s64)(abs(delta) - s->stats[index]) >> 2;
}
/**