Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: set -Wno-format-truncation globally #15908

Closed
wants to merge 2 commits into from

Commits on Feb 19, 2024

  1. config: use -Wno-format-truncation globally

    -Wformat-truncation looks for places where the return code of snprintf()
    is unchecked and the provided buffer might be too short. This is based
    on a heuristic that can change between compiler versions.
    
    It has been seen to get this wrong in ddt_object_name(), leading to
    DDT_NAMELEN being increased somewhat arbitrarily.
    
    There's no good reason to have this warning enabled, so here we disable
    it everywhere. Truncation may be undesirable, but snprintf() is
    guaranteed to emit a trailing null, so at worst we get a short string,
    not a buffer overrun.
    
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://despairlabs.com/sponsor/
    robn committed Feb 19, 2024
    Configuration menu
    Copy the full SHA
    28054c8 View commit details
    Browse the repository at this point in the history
  2. ddt: reduce DDT_NAMELEN

    This is the buffer size passed to ddt_object_name(), to expand the
    DMU_POOL_DDT format. That format inserts the table checksum, class and
    type names, which as I write this are max 6, 9 and 3, respectively.
    
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://despairlabs.com/sponsor/
    robn committed Feb 19, 2024
    Configuration menu
    Copy the full SHA
    220c772 View commit details
    Browse the repository at this point in the history