)]}'
{
  "commit": "2a0e0a35002db7ac64f4e82ea2a4ad2fb6d934b0",
  "tree": "5f80aacb548999f057baa19b1fe63ef4764efd97",
  "parents": [
    "cd341fd1ffded978b2aa0b5309b00be7c42e347c"
  ],
  "author": {
    "name": "Zhao Liu",
    "email": "zhao1.liu@intel.com",
    "time": "Fri Feb 23 16:56:47 2024 +0800"
  },
  "committer": {
    "name": "Michael S. Tsirkin",
    "email": "mst@redhat.com",
    "time": "Tue Mar 12 17:56:55 2024 -0400"
  },
  "message": "hw/cxl/cxl-host: Fix missing ERRP_GUARD() in cxl_fixed_memory_window_config()\n\nAs the comment in qapi/error, dereferencing @errp requires\nERRP_GUARD():\n\n* \u003d Why, when and how to use ERRP_GUARD() \u003d\n*\n* Without ERRP_GUARD(), use of the @errp parameter is restricted:\n* - It must not be dereferenced, because it may be null.\n...\n* ERRP_GUARD() lifts these restrictions.\n*\n* To use ERRP_GUARD(), add it right at the beginning of the function.\n* @errp can then be used without worrying about the argument being\n* NULL or \u0026error_fatal.\n*\n* Using it when it\u0027s not needed is safe, but please avoid cluttering\n* the source with useless code.\n\nBut in cxl_fixed_memory_window_config(), @errp is dereferenced in 2\nplaces without ERRP_GUARD():\n\nfw-\u003eenc_int_ways \u003d cxl_interleave_ways_enc(fw-\u003enum_targets, errp);\nif (*errp) {\n    return;\n}\n\nand\n\nfw-\u003eenc_int_gran \u003d\n    cxl_interleave_granularity_enc(object-\u003einterleave_granularity,\n                                   errp);\nif (*errp) {\n    return;\n}\n\nFor the above 2 places, we check \"*errp\", because neither function\nreturns a suitable error code. And since machine_set_cfmw() - the caller\nof cxl_fixed_memory_window_config() - doesn\u0027t get the NULL @errp\nparameter as the \"set\" method of object property,\ncxl_fixed_memory_window_config() hasn\u0027t triggered the bug that\ndereferencing the NULL @errp.\n\nTo follow the requirement of @errp, add missing ERRP_GUARD() in\ncxl_fixed_memory_window_config().\n\nSuggested-by: Markus Armbruster \u003carmbru@redhat.com\u003e\nSigned-off-by: Zhao Liu \u003czhao1.liu@intel.com\u003e\nReviewed-by: Markus Armbruster \u003carmbru@redhat.com\u003e\nMessage-Id: \u003c20240223085653.1255438-2-zhao1.liu@linux.intel.com\u003e\nReviewed-by: Michael S. Tsirkin \u003cmst@redhat.com\u003e\nSigned-off-by: Michael S. Tsirkin \u003cmst@redhat.com\u003e\nAcked-by: Jonathan Cameron \u003cJonathan.Cameron@huawei.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2aa776c79c7465198328046d32072c58110c7fc7",
      "old_mode": 33188,
      "old_path": "hw/cxl/cxl-host.c",
      "new_id": "c5f5fcfd64d00d400e8d3640afb1bbe0de7bb49b",
      "new_mode": 33188,
      "new_path": "hw/cxl/cxl-host.c"
    }
  ]
}
