diff options
author | Hans de Goede <hdegoede@redhat.com> | 2024-09-05 16:51:58 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2024-09-05 16:57:36 +0200 |
commit | 56d8b784c56588cd40f98e4b1d4f6e29e3cb02b8 (patch) | |
tree | 5edd10e48440fcbb5a76bbb9b78dc1706b3d5cec /drivers/misc/lkdtm/refcount.c | |
parent | 3a1fb526c2482b2f61c9813e9e14fcdab4ffa390 (diff) | |
parent | a54da9df75cd1b4b5028f6c60f9a211532680585 (diff) |
Merge tag 'hwmon-for-v6.11-rc7' into review-hans
Merge "hwmon fixes for v6.11-rc7" into review-hans to bring in
commit a54da9df75cd ("hwmon: (hp-wmi-sensors) Check if WMI event
data exists").
This is a dependency for a set of WMI event data refactoring changes.
Diffstat (limited to 'drivers/misc/lkdtm/refcount.c')
-rw-r--r-- | drivers/misc/lkdtm/refcount.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/misc/lkdtm/refcount.c b/drivers/misc/lkdtm/refcount.c index 5cd488f54cfa..8f744bee6fbd 100644 --- a/drivers/misc/lkdtm/refcount.c +++ b/drivers/misc/lkdtm/refcount.c @@ -182,6 +182,21 @@ static void lkdtm_REFCOUNT_SUB_AND_TEST_NEGATIVE(void) check_negative(&neg, 3); } +/* + * A refcount_sub_and_test() by zero when the counter is at zero should act like + * refcount_sub_and_test() above when going negative. + */ +static void lkdtm_REFCOUNT_SUB_AND_TEST_ZERO(void) +{ + refcount_t neg = REFCOUNT_INIT(0); + + pr_info("attempting bad refcount_sub_and_test() at zero\n"); + if (refcount_sub_and_test(0, &neg)) + pr_warn("Weird: refcount_sub_and_test() reported zero\n"); + + check_negative(&neg, 0); +} + static void check_from_zero(refcount_t *ref) { switch (refcount_read(ref)) { @@ -400,6 +415,7 @@ static struct crashtype crashtypes[] = { CRASHTYPE(REFCOUNT_DEC_NEGATIVE), CRASHTYPE(REFCOUNT_DEC_AND_TEST_NEGATIVE), CRASHTYPE(REFCOUNT_SUB_AND_TEST_NEGATIVE), + CRASHTYPE(REFCOUNT_SUB_AND_TEST_ZERO), CRASHTYPE(REFCOUNT_INC_ZERO), CRASHTYPE(REFCOUNT_ADD_ZERO), CRASHTYPE(REFCOUNT_INC_SATURATED), |