Project

General

Profile

Actions

Bug #14192

open

kstat_delete(9F) should decide how it feels about NULL

Added by Ryan Zezeski 3 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
kernel
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

The kstat_delete(9F) function seems to be confused on how it feels about ksp = NULL depending on DEBUG vs non-DEBUG.

void
kstat_delete(kstat_t *ksp)
{
    kmutex_t *lp;
    ekstat_t *e = (ekstat_t *)ksp;
    zoneid_t zoneid;
    kstat_zone_t *kz;

    ASSERT(ksp != NULL);

    if (ksp == NULL)
        return;

I have a case where it would be convenient to elide the NULL check in my driver code and just let kstat_delete(9F) handle it. But I can't do that because it would break a DEBUG build. So, I propose one of two things:

1. Remove the ASSERT and allow NULL to be a valid argument. In this case the man page should also be updated to document that NULL is an acceptable argument.

2. Add a sentence to the man page indicating that NULL is not a valid argument (I guess we would still keep the NULL check in the function to avoid panicking the host in the case of a buggy consumer, but we would at least document that the consumer should not rely on this behavior).

Thoughts?

Actions #1

Updated by Robert Mustacchi 3 months ago

  • Related to Bug #14195: pci_cap_locate and pci_xcap_locate need additional bounds added
Actions #2

Updated by Robert Mustacchi 3 months ago

  • Related to deleted (Bug #14195: pci_cap_locate and pci_xcap_locate need additional bounds)
Actions

Also available in: Atom PDF