diff options
author | Jonathan Corbet <corbet@lwn.net> | 2024-09-05 14:01:38 -0600 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2024-09-05 14:01:38 -0600 |
commit | d224338aa105bf3c4c4aa8b2ccdbd675c71ffbfe (patch) | |
tree | b7b6b8c98595c89f7ad5307120cb3156708991bc /drivers/misc/lkdtm/refcount.c | |
parent | eb5ed2fae19745fcb7dd0dcfbfbcd8b2847bc5c1 (diff) | |
parent | 431c1646e1f86b949fa3685efc50b660a364c2b6 (diff) | |
download | lwn-d224338aa105bf3c4c4aa8b2ccdbd675c71ffbfe.tar.gz lwn-d224338aa105bf3c4c4aa8b2ccdbd675c71ffbfe.zip |
Merge tag 'v6.11-rc6' into docs-mw
This is done primarily to get a docs build fix merged via another tree so
that "make htmldocs" stops failing.
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), |