)]}'
{
  "commit": "0b7cd6fa9affca49c70f324594a02ecf1bc7f15d",
  "tree": "7584334b4839ff74a287c8bcac62efff94d5750e",
  "parents": [
    "b73dfe1ea7be7a072482434643b517d7726f4c8d"
  ],
  "author": {
    "name": "Wake Liu",
    "email": "wakel@google.com",
    "time": "Wed Dec 24 16:41:20 2025 +0800"
  },
  "committer": {
    "name": "Greg Kroah-Hartman",
    "email": "gregkh@linuxfoundation.org",
    "time": "Fri Mar 13 17:20:45 2026 +0100"
  },
  "message": "kselftest/harness: Use helper to avoid zero-size memset warning\n\n[ Upstream commit 19b8a76cd99bde6d299e60490f3e62b8d3df3997 ]\n\nWhen building kselftests with a toolchain that enables source\nfortification (e.g., Android\u0027s build environment, which uses\n-D_FORTIFY_SOURCE\u003d3), a build failure occurs in tests that use an\nempty FIXTURE().\n\nThe root cause is that an empty fixture struct results in\n`sizeof(self_private)` evaluating to 0. The compiler\u0027s fortification\nchecks then detect the `memset()` call with a compile-time constant size\nof 0, issuing a `-Wuser-defined-warnings` which is promoted to an error\nby `-Werror`.\n\nAn initial attempt to guard the call with `if (sizeof(self_private) \u003e 0)`\nwas insufficient. The compiler\u0027s static analysis is aggressive enough\nto flag the `memset(..., 0)` pattern before evaluating the conditional,\nthus still triggering the error.\n\nTo resolve this robustly, this change introduces a `static inline`\nhelper function, `__kselftest_memset_safe()`. This function wraps the\nsize check and the `memset()` call. By replacing the direct `memset()`\nin the `__TEST_F_IMPL` macro with a call to this helper, we create an\nabstraction boundary. This prevents the compiler\u0027s static analyzer from\n\"seeing\" the problematic pattern at the macro expansion site, resolving\nthe build failure.\n\nBuild Context:\nCompiler: Android (14488419, +pgo, +bolt, +lto, +mlgo, based on r584948) clang version 22.0.0 (https://android.googlesource.com/toolchain/llvm-project 2d65e4108033380e6fe8e08b1f1826cd2bfb0c99)\nRelevant Options: -O2 -Wall -Werror -D_FORTIFY_SOURCE\u003d3 -target i686-linux-android10000\n\nTest: m kselftest_futex_futex_requeue_pi\n\nRemoved Gerrit Change-Id\nShuah Khan \u003cskhan@linuxfoundation.org\u003e\n\nLink: https://lore.kernel.org/r/20251224084120.249417-1-wakel@google.com\nSigned-off-by: Wake Liu \u003cwakel@google.com\u003e\nSigned-off-by: Shuah Khan \u003cskhan@linuxfoundation.org\u003e\nStable-dep-of: 6be268151426 (\"selftests/harness: order TEST_F and XFAIL_ADD constructors\")\nSigned-off-by: Sasha Levin \u003csashal@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "666c9fde76da9d25fe6e248a7f2143c113473fe1",
      "old_mode": 33188,
      "old_path": "tools/testing/selftests/kselftest_harness.h",
      "new_id": "d67ec4d762db3cbed4dd00bfdbc76a3ccd061d5c",
      "new_mode": 33188,
      "new_path": "tools/testing/selftests/kselftest_harness.h"
    }
  ]
}
