)]}'
{
  "commit": "656e9007ef5862746cdf7ac16267c8e06e7b0989",
  "tree": "ef0e41da56c4b51f697f168e83a2c4c062020fe3",
  "parents": [
    "05d3855b4d21ef3c2df26be1cbba9d2c68915fcb"
  ],
  "author": {
    "name": "Arnd Bergmann",
    "email": "arnd@arndb.de",
    "time": "Thu Mar 02 09:53:31 2023 +0100"
  },
  "committer": {
    "name": "Arnd Bergmann",
    "email": "arnd@arndb.de",
    "time": "Tue Apr 04 17:58:11 2023 +0200"
  },
  "message": "asm-generic: avoid __generic_cmpxchg_local warnings\n\nCode that passes a 32-bit constant into cmpxchg() produces a harmless\nsparse warning because of the truncation in the branch that is not taken:\n\nfs/erofs/zdata.c: note: in included file (through /home/arnd/arm-soc/arch/arm/include/asm/cmpxchg.h, /home/arnd/arm-soc/arch/arm/include/asm/atomic.h, /home/arnd/arm-soc/include/linux/atomic.h, ...):\ninclude/asm-generic/cmpxchg-local.h:29:33: warning: cast truncates bits from constant value (5f0ecafe becomes fe)\ninclude/asm-generic/cmpxchg-local.h:33:34: warning: cast truncates bits from constant value (5f0ecafe becomes cafe)\ninclude/asm-generic/cmpxchg-local.h:29:33: warning: cast truncates bits from constant value (5f0ecafe becomes fe)\ninclude/asm-generic/cmpxchg-local.h:30:42: warning: cast truncates bits from constant value (5f0edead becomes ad)\ninclude/asm-generic/cmpxchg-local.h:33:34: warning: cast truncates bits from constant value (5f0ecafe becomes cafe)\ninclude/asm-generic/cmpxchg-local.h:34:44: warning: cast truncates bits from constant value (5f0edead becomes dead)\n\nThis was reported as a regression to Matt\u0027s recent __generic_cmpxchg_local\npatch, though this patch only added more warnings on top of the ones\nthat were already there.\n\nRewording the truncation to use an explicit bitmask instead of a cast\nto a smaller type avoids the warning but otherwise leaves the code\nunchanged.\n\nI had another look at why the cast is even needed for atomic_cmpxchg(),\nand as Matt describes the problem here is that atomic_t contains a\nsigned \u0027int\u0027, but cmpxchg() takes an \u0027unsigned long\u0027 argument, and\nconverting between the two leads to a 64-bit sign-extension of\nnegative 32-bit atomics.\n\nI checked the other implementations of arch_cmpxchg() and did not find\nany others that run into the same problem as __generic_cmpxchg_local(),\nbut it\u0027s easy to be on the safe side here and always convert the\nsigned int into an unsigned int when calling arch_cmpxchg(), as this\nwill work even when any of the arch_cmpxchg() implementations run\ninto the same problem.\n\nFixes: 624654152284 (\"locking/atomic: cmpxchg: Make __generic_cmpxchg_local compare against zero-extended \u0027old\u0027 value\")\nReviewed-by: Matt Evans \u003cmev@rivosinc.com\u003e\nSigned-off-by: Arnd Bergmann \u003carnd@arndb.de\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "04b8be9f1a77ceb93375a26b6079bb122bea1877",
      "old_mode": 33188,
      "old_path": "include/asm-generic/atomic.h",
      "new_id": "e271d6708c876bd94d96b4bcc369f793c2e0b370",
      "new_mode": 33188,
      "new_path": "include/asm-generic/atomic.h"
    },
    {
      "type": "modify",
      "old_id": "c3e7315b7c1d660ff02ce230d47287291f0e6787",
      "old_mode": 33188,
      "old_path": "include/asm-generic/cmpxchg-local.h",
      "new_id": "3df9f59a544e48bdd375cf119f05fa13122ed747",
      "new_mode": 33188,
      "new_path": "include/asm-generic/cmpxchg-local.h"
    },
    {
      "type": "modify",
      "old_id": "dca4419922a971fea7037a70ce7a550d37a92459",
      "old_mode": 33188,
      "old_path": "include/asm-generic/cmpxchg.h",
      "new_id": "848de25fc4bf8f2b4d5e368e1621beec90e25b4a",
      "new_mode": 33188,
      "new_path": "include/asm-generic/cmpxchg.h"
    }
  ]
}
