| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/11/22 12:50 | flow | patch-triage |
7mArgs:null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"SECURITY",
"SECURITY_LANDLOCK",
"NET_KEY",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"INET"
],
"FocusSymbols": [
"bpf_prog_test_run_sk_lookup",
"verify_address_len",
"hook_socket_connect",
"ieee80211_process_addba_request",
"ieee80211_process_addba_resp",
"validate_beacon_head",
"mac80211_hwsim_write_tsf",
"__udp4_lib_mcast_deliver"
],
"KMSANReasoning": "The patch is a pure syntactic refactoring. It introduces the helper macro `struct_offsetofend(p, member)` in `include/linux/overflow.h` (defined as `(offsetofend(typeof(*(p)), member))`) and a Coccinelle script `scripts/coccinelle/api/struct_offsetof.cocci`, then systematically replaces instances of `offsetof(typeof(*(p)), member)` with `struct_offset(p, member)` and `offsetofend(typeof(*(p)), member)` with `struct_offsetofend(p, member)`.\n\nBecause the macro expansions are identical to the original expressions, the generated machine code and runtime behavior remain entirely unchanged. No changes are made to buffer allocations, memory initialization, data copying, or control flow, and no uninitialized memory hazards or information leak risks are created. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false,
"Reasoning": "The patch introduces the struct_offsetofend macro helper and refactors offset calculations across multiple reachable core subsystems, including BPF syscall test runs, Landlock security hooks, AF_KEY socket validation, mac80211 wireless protocol frame handling, and UDP multicast delivery. Even though intended as a refactoring/cleanup, modifying offset calculations in reachable core networking, security, and BPF code warrants fuzzing to ensure no regressions or boundary evaluation discrepancies occur.",
"WorthFuzzing": true
} |
| 1/1 | 2026/11/22 12:50 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit e9ed11040ab7cc34826cc8cae2ae50d9d266f3ed\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Sun Nov 22 12:50:26 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c\nindex d449fbdde46406..cd98beaf6cb6ef 100644\n--- a/drivers/bluetooth/btmrvl_main.c\n+++ b/drivers/bluetooth/btmrvl_main.c\n@@ -81,7 +81,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)\n \tstruct btmrvl_event *event;\n \tint ret = 0;\n \n-\tif (skb-\u003elen \u003c= offsetof(typeof(*event), data[0]))\n+\tif (skb-\u003elen \u003c= struct_offset(event, data[0]))\n \t\treturn -EINVAL;\n \n \tevent = (struct btmrvl_event *) skb-\u003edata;\n@@ -92,7 +92,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)\n \n \tswitch (event-\u003edata[0]) {\n \tcase BT_EVENT_AUTO_SLEEP_MODE:\n-\t\tif (skb-\u003elen \u003c= offsetof(typeof(*event), data[2]))\n+\t\tif (skb-\u003elen \u003c= struct_offset(event, data[2]))\n \t\t\treturn -EINVAL;\n \t\tif (!event-\u003edata[2]) {\n \t\t\tif (event-\u003edata[1] == BT_PS_ENABLE)\n@@ -107,7 +107,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)\n \t\tbreak;\n \n \tcase BT_EVENT_HOST_SLEEP_CONFIG:\n-\t\tif (skb-\u003elen \u003c= offsetof(typeof(*event), data[3]))\n+\t\tif (skb-\u003elen \u003c= struct_offset(event, data[3]))\n \t\t\treturn -EINVAL;\n \t\tif (!event-\u003edata[3])\n \t\t\tBT_DBG(\"gpio=%x, gap=%x\", event-\u003edata[1],\n@@ -117,7 +117,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)\n \t\tbreak;\n \n \tcase BT_EVENT_HOST_SLEEP_ENABLE:\n-\t\tif (skb-\u003elen \u003c= offsetof(typeof(*event), data[1]))\n+\t\tif (skb-\u003elen \u003c= struct_offset(event, data[1]))\n \t\t\treturn -EINVAL;\n \t\tif (!event-\u003edata[1]) {\n \t\t\tadapter-\u003ehs_state = HS_ACTIVATED;\n@@ -131,7 +131,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)\n \t\tbreak;\n \n \tcase BT_EVENT_MODULE_CFG_REQ:\n-\t\tif (skb-\u003elen \u003c= offsetof(typeof(*event), data[2]))\n+\t\tif (skb-\u003elen \u003c= struct_offset(event, data[2]))\n \t\t\treturn -EINVAL;\n \t\tif (priv-\u003ebtmrvl_dev.sendcmdflag \u0026\u0026\n \t\t\t\tevent-\u003edata[1] == MODULE_BRINGUP_REQ) {\n@@ -150,7 +150,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)\n \t\tbreak;\n \n \tcase BT_EVENT_POWER_STATE:\n-\t\tif (skb-\u003elen \u003c= offsetof(typeof(*event), data[1]))\n+\t\tif (skb-\u003elen \u003c= struct_offset(event, data[1]))\n \t\t\treturn -EINVAL;\n \t\tif (event-\u003edata[1] == BT_PS_SLEEP)\n \t\t\tadapter-\u003eps_state = PS_SLEEP;\ndiff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c\nindex 2365a6d8ca15f6..a751a972aea17d 100644\n--- a/drivers/dma-buf/dma-resv.c\n+++ b/drivers/dma-buf/dma-resv.c\n@@ -108,7 +108,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int max_fences)\n \t\treturn NULL;\n \n \t/* Given the resulting bucket size, recalculated max_fences. */\n-\tlist-\u003emax_fences = (size - offsetof(typeof(*list), table)) /\n+\tlist-\u003emax_fences = (size - struct_offset(list, table)) /\n \t\tsizeof(*list-\u003etable);\n \n \treturn list;\ndiff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c\nindex a9cea09355ff4b..12b8cceb3d200e 100644\n--- a/drivers/firmware/arm_scmi/base.c\n+++ b/drivers/firmware/arm_scmi/base.c\n@@ -340,7 +340,7 @@ static void *scmi_base_fill_custom_report(const struct scmi_protocol_handle *ph,\n \tif (evt_id != SCMI_EVENT_BASE_ERROR_EVENT || sizeof(*p) \u003c payld_sz)\n \t\treturn NULL;\n \n-\texpected_sz = offsetof(typeof(*p), msg_reports);\n+\texpected_sz = struct_offset(p, msg_reports);\n \tif (payld_sz \u003c expected_sz)\n \t\treturn NULL;\n \ndiff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c\nindex b8f882a17c8f1d..e7dcaa1f2f58d6 100644\n--- a/drivers/gpu/drm/drm_edid.c\n+++ b/drivers/gpu/drm/drm_edid.c\n@@ -3124,9 +3124,9 @@ EXPORT_SYMBOL(drm_mode_find_dmt);\n \n static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 type)\n {\n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);\n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.pad1) != 2);\n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.type) != 3);\n+\tBUILD_BUG_ON(struct_offset(descriptor, pixel_clock) != 0);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.pad1) != 2);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.type) != 3);\n \n \treturn descriptor-\u003epixel_clock == 0 \u0026\u0026\n \t\tdescriptor-\u003edata.other_data.pad1 == 0 \u0026\u0026\n@@ -3135,7 +3135,7 @@ static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 t\n \n static bool is_detailed_timing_descriptor(const struct detailed_timing *descriptor)\n {\n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);\n+\tBUILD_BUG_ON(struct_offset(descriptor, pixel_clock) != 0);\n \n \treturn descriptor-\u003epixel_clock != 0;\n }\n@@ -3207,8 +3207,8 @@ is_rb(const struct detailed_timing *descriptor, void *data)\n \tif (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))\n \t\treturn;\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);\n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.cvt.flags) != 15);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.cvt.flags) != 15);\n \n \tif (descriptor-\u003edata.other_data.data.range.flags == DRM_EDID_CVT_SUPPORT_FLAG \u0026\u0026\n \t descriptor-\u003edata.other_data.data.range.formula.cvt.flags \u0026 DRM_EDID_CVT_FLAGS_REDUCED_BLANKING)\n@@ -3237,7 +3237,7 @@ find_gtf2(const struct detailed_timing *descriptor, void *data)\n \tif (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))\n \t\treturn;\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);\n \n \tif (descriptor-\u003edata.other_data.data.range.flags == DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG)\n \t\t*res = descriptor;\n@@ -3251,7 +3251,9 @@ drm_gtf2_hbreak(const struct drm_edid *drm_edid)\n \n \tdrm_for_each_detailed_block(drm_edid, find_gtf2, \u0026descriptor);\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.hfreq_start_khz) != 12);\n+\tBUILD_BUG_ON(struct_offset(descriptor,\n+\t\t\t\t data.other_data.data.range.formula.gtf2.hfreq_start_khz\n+\t\t ) != 12);\n \n \treturn descriptor ? descriptor-\u003edata.other_data.data.range.formula.gtf2.hfreq_start_khz * 2 : 0;\n }\n@@ -3263,7 +3265,7 @@ drm_gtf2_2c(const struct drm_edid *drm_edid)\n \n \tdrm_for_each_detailed_block(drm_edid, find_gtf2, \u0026descriptor);\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.c) != 13);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.c) != 13);\n \n \treturn descriptor ? descriptor-\u003edata.other_data.data.range.formula.gtf2.c : 0;\n }\n@@ -3275,7 +3277,7 @@ drm_gtf2_m(const struct drm_edid *drm_edid)\n \n \tdrm_for_each_detailed_block(drm_edid, find_gtf2, \u0026descriptor);\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.m) != 14);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.m) != 14);\n \n \treturn descriptor ? le16_to_cpu(descriptor-\u003edata.other_data.data.range.formula.gtf2.m) : 0;\n }\n@@ -3287,7 +3289,7 @@ drm_gtf2_k(const struct drm_edid *drm_edid)\n \n \tdrm_for_each_detailed_block(drm_edid, find_gtf2, \u0026descriptor);\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.k) != 16);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.k) != 16);\n \n \treturn descriptor ? descriptor-\u003edata.other_data.data.range.formula.gtf2.k : 0;\n }\n@@ -3299,7 +3301,7 @@ drm_gtf2_2j(const struct drm_edid *drm_edid)\n \n \tdrm_for_each_detailed_block(drm_edid, find_gtf2, \u0026descriptor);\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.j) != 17);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.j) != 17);\n \n \treturn descriptor ? descriptor-\u003edata.other_data.data.range.formula.gtf2.j : 0;\n }\n@@ -3312,7 +3314,7 @@ get_timing_level(const struct detailed_timing *descriptor, void *data)\n \tif (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))\n \t\treturn;\n \n-\tBUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);\n+\tBUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);\n \n \tswitch (descriptor-\u003edata.other_data.data.range.flags) {\n \tcase DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG:\ndiff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c\nindex 9e01f8b2079aba..598c1271cae198 100644\n--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c\n+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c\n@@ -101,8 +101,8 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,\n \t * A gem object is embedded both in a struct ttm_buffer_object :/ and\n \t * in a drm_i915_gem_object. Make sure they are aliased.\n \t */\n-\tBUILD_BUG_ON(offsetof(typeof(*obj), base) !=\n-\t\t offsetof(typeof(*obj), __do_not_access.base));\n+\tBUILD_BUG_ON(struct_offset(obj, base) !=\n+\t\t struct_offset(obj, __do_not_access.base));\n \n \tspin_lock_init(\u0026obj-\u003evma.lock);\n \tINIT_LIST_HEAD(\u0026obj-\u003evma.list);\ndiff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c\nindex b2442f05825ee2..48a773b3cde925 100644\n--- a/drivers/gpu/drm/i915/i915_active.c\n+++ b/drivers/gpu/drm/i915/i915_active.c\n@@ -263,7 +263,7 @@ static struct active_node *__active_lookup(struct i915_active *ref, u64 idx)\n \t\t\treturn it;\n \t}\n \n-\tBUILD_BUG_ON(offsetof(typeof(*it), node));\n+\tBUILD_BUG_ON(struct_offset(it, node));\n \n \t/* While active, the tree can only be built; not destroyed */\n \tGEM_BUG_ON(i915_active_is_idle(ref));\ndiff --git a/drivers/gpu/drm/i915/i915_sw_fence_work.c b/drivers/gpu/drm/i915/i915_sw_fence_work.c\nindex 366418108f78f4..c059bb1e9492ef 100644\n--- a/drivers/gpu/drm/i915/i915_sw_fence_work.c\n+++ b/drivers/gpu/drm/i915/i915_sw_fence_work.c\n@@ -70,7 +70,7 @@ static void fence_release(struct dma_fence *fence)\n \n \ti915_sw_fence_fini(\u0026f-\u003echain);\n \n-\tBUILD_BUG_ON(offsetof(typeof(*f), dma));\n+\tBUILD_BUG_ON(struct_offset(f, dma));\n \tdma_fence_free(\u0026f-\u003edma);\n }\n \ndiff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c\nindex fe590a045d70af..279309d008f0c5 100644\n--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c\n+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c\n@@ -1171,7 +1171,7 @@ r535_gsp_shared_init(struct nvkm_gsp *gsp)\n \tcmdq-\u003etx.msgCount = (cmdq-\u003etx.size - cmdq-\u003etx.entryOff) / cmdq-\u003etx.msgSize;\n \tcmdq-\u003etx.writePtr = 0;\n \tcmdq-\u003etx.flags = 1;\n-\tcmdq-\u003etx.rxHdrOff = offsetof(typeof(*cmdq), rx.readPtr);\n+\tcmdq-\u003etx.rxHdrOff = struct_offset(cmdq, rx.readPtr);\n \n \tmsgq = gsp-\u003eshm.msgq.ptr;\n \ndiff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c\nindex a9136a6523cbac..247f6d9b449499 100644\n--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c\n+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c\n@@ -2609,12 +2609,12 @@ static int vmw_cmd_dx_check_subresource(struct vmw_private *dev_priv,\n \t\t};\n \t} *cmd;\n \n-\tBUILD_BUG_ON(offsetof(typeof(*cmd), r_body.sid) !=\n-\t\t offsetof(typeof(*cmd), sid));\n-\tBUILD_BUG_ON(offsetof(typeof(*cmd), i_body.sid) !=\n-\t\t offsetof(typeof(*cmd), sid));\n-\tBUILD_BUG_ON(offsetof(typeof(*cmd), u_body.sid) !=\n-\t\t offsetof(typeof(*cmd), sid));\n+\tBUILD_BUG_ON(struct_offset(cmd, r_body.sid) !=\n+\t\t struct_offset(cmd, sid));\n+\tBUILD_BUG_ON(struct_offset(cmd, i_body.sid) !=\n+\t\t struct_offset(cmd, sid));\n+\tBUILD_BUG_ON(struct_offset(cmd, u_body.sid) !=\n+\t\t struct_offset(cmd, sid));\n \n \tcmd = container_of(header, typeof(*cmd), header);\n \treturn vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,\ndiff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c\nindex 5301e4f21ade0e..1662aeebf1349a 100644\n--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c\n+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c\n@@ -780,7 +780,7 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq,\n \tsrqe-\u003ewqe_type = wqe-\u003etype;\n \tsrqe-\u003eflags = wqe-\u003eflags;\n \tsrqe-\u003ewqe_size = wqe-\u003enum_sge +\n-\t\t\t((offsetof(typeof(*srqe), data) + 15) \u003e\u003e 4);\n+\t\t\t((struct_offset(srqe, data) + 15) \u003e\u003e 4);\n \tsrqe-\u003ewr_id[0] = cpu_to_le32((u32)next);\n \tsrq-\u003eswq[next].wr_id = wqe-\u003ewr_id;\n \ndiff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c\nindex 7dfaa01cda670b..df4d57c4e85e36 100644\n--- a/drivers/infiniband/hw/hns/hns_roce_cq.c\n+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c\n@@ -287,7 +287,7 @@ static int alloc_cq_db(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq,\n \n \tif (udata) {\n \t\tif (has_db \u0026\u0026\n-\t\t udata-\u003eoutlen \u003e= offsetofend(typeof(*resp), cap_flags)) {\n+\t\t udata-\u003eoutlen \u003e= struct_offsetofend(resp, cap_flags)) {\n \t\t\tuctx = rdma_udata_to_drv_context(udata,\n \t\t\t\t\tstruct hns_roce_ucontext, ibucontext);\n \t\t\terr = hns_roce_db_map_user(uctx, addr, \u0026hr_cq-\u003edb);\n@@ -378,7 +378,7 @@ static int set_cqe_size(struct hns_roce_cq *hr_cq, struct ib_udata *udata,\n \t\treturn 0;\n \t}\n \n-\tif (udata-\u003einlen \u003e= offsetofend(typeof(*ucmd), cqe_size)) {\n+\tif (udata-\u003einlen \u003e= struct_offsetofend(ucmd, cqe_size)) {\n \t\tif (ucmd-\u003ecqe_size != HNS_ROCE_V2_CQE_SIZE \u0026\u0026\n \t\t ucmd-\u003ecqe_size != HNS_ROCE_V3_CQE_SIZE) {\n \t\t\tibdev_err(\u0026hr_dev-\u003eib_dev,\ndiff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c\nindex c6c0dfdbdbc303..e46c6cc1e3ee63 100644\n--- a/drivers/infiniband/hw/hns/hns_roce_qp.c\n+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c\n@@ -836,9 +836,9 @@ static inline bool user_qp_has_sdb(struct hns_roce_dev *hr_dev,\n \t\t\t\t struct hns_roce_ib_create_qp *ucmd)\n {\n \treturn ((hr_dev-\u003ecaps.flags \u0026 HNS_ROCE_CAP_FLAG_QP_RECORD_DB) \u0026\u0026\n-\t\tudata-\u003eoutlen \u003e= offsetofend(typeof(*resp), cap_flags) \u0026\u0026\n+\t\tudata-\u003eoutlen \u003e= struct_offsetofend(resp, cap_flags) \u0026\u0026\n \t\thns_roce_qp_has_sq(init_attr) \u0026\u0026\n-\t\tudata-\u003einlen \u003e= offsetofend(typeof(*ucmd), sdb_addr));\n+\t\tudata-\u003einlen \u003e= struct_offsetofend(ucmd, sdb_addr));\n }\n \n static inline bool user_qp_has_rdb(struct hns_roce_dev *hr_dev,\n@@ -847,7 +847,7 @@ static inline bool user_qp_has_rdb(struct hns_roce_dev *hr_dev,\n \t\t\t\t struct hns_roce_ib_create_qp_resp *resp)\n {\n \treturn ((hr_dev-\u003ecaps.flags \u0026 HNS_ROCE_CAP_FLAG_QP_RECORD_DB) \u0026\u0026\n-\t\tudata-\u003eoutlen \u003e= offsetofend(typeof(*resp), cap_flags) \u0026\u0026\n+\t\tudata-\u003eoutlen \u003e= struct_offsetofend(resp, cap_flags) \u0026\u0026\n \t\thns_roce_qp_has_rq(init_attr));\n }\n \ndiff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c\nindex 644c2f1cd8e634..4cf876f4b7eaae 100644\n--- a/drivers/media/usb/uvc/uvc_v4l2.c\n+++ b/drivers/media/usb/uvc/uvc_v4l2.c\n@@ -1108,7 +1108,7 @@ static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,\n static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,\n \t\t\tstruct uvc_xu_control_mapping32 __user *up)\n {\n-\tif (copy_to_user(up, kp, offsetof(typeof(*up), menu_info)) ||\n+\tif (copy_to_user(up, kp, struct_offset(up, menu_info)) ||\n \t put_user(kp-\u003emenu_count, \u0026up-\u003emenu_count))\n \t\treturn -EFAULT;\n \n@@ -1147,7 +1147,7 @@ static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,\n static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,\n \t\t\tstruct uvc_xu_control_query32 __user *up)\n {\n-\tif (copy_to_user(up, kp, offsetof(typeof(*up), data)))\n+\tif (copy_to_user(up, kp, struct_offset(up, data)))\n \t\treturn -EFAULT;\n \treturn 0;\n }\ndiff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c\nindex 96225132750695..efebabd1ae04d9 100644\n--- a/drivers/net/hyperv/rndis_filter.c\n+++ b/drivers/net/hyperv/rndis_filter.c\n@@ -1041,7 +1041,7 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,\n \tset = \u0026request-\u003erequest_msg.msg.set_req;\n \tset-\u003eoid = RNDIS_OID_GEN_CURRENT_PACKET_FILTER;\n \tset-\u003einfo_buflen = sizeof(u32);\n-\tset-\u003einfo_buf_offset = offsetof(typeof(*set), info_buf);\n+\tset-\u003einfo_buf_offset = struct_offset(set, info_buf);\n \tmemcpy(set-\u003einfo_buf, \u0026new_filter, sizeof(u32));\n \n \tret = rndis_filter_send_request(dev, request);\ndiff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c\nindex 0982e60842b1c6..01bdc0e9635d34 100644\n--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c\n+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c\n@@ -736,7 +736,7 @@ static void iwl_parse_dbg_tlv_assert_tables(struct iwl_drv *drv,\n \tu32 length = le32_to_cpu(tlv-\u003elength);\n \tu32 addr;\n \n-\tif (length \u003c offsetof(typeof(*region), special_mem) +\n+\tif (length \u003c struct_offset(region, special_mem) +\n \t\t sizeof(region-\u003especial_mem))\n \t\treturn;\n \ndiff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c\nindex e2382be8edd78d..5faa97a420d8ec 100644\n--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c\n+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c\n@@ -625,7 +625,7 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,\n \tcfg_cmd.sta_id = mvm_link_sta-\u003esta_id;\n \n \tlq_sta = \u0026mvm_link_sta-\u003elq_sta.rs_fw;\n-\tmemset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));\n+\tmemset(lq_sta, 0, struct_offset(lq_sta, pers));\n \n \trcu_read_unlock();\n \ndiff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c\nindex d1619a229d8f2b..da0669155a3b08 100644\n--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c\n+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c\n@@ -2939,7 +2939,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,\n \tlockdep_assert_held(\u0026mvmsta-\u003edeflink.lq_sta.rs_drv.pers.lock);\n \n \t/* clear all non-persistent lq data */\n-\tmemset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));\n+\tmemset(lq_sta, 0, struct_offset(lq_sta, pers));\n \n \tsband = hw-\u003ewiphy-\u003ebands[band];\n \ndiff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c\nindex 0009a05511af17..a5a065275f18dc 100644\n--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c\n+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c\n@@ -241,7 +241,7 @@ int iwl_pcie_ctxt_info_v2_alloc(struct iwl_trans *trans,\n \t * optional; old devices _should_ be fine with a bigger size,\n \t * but in simulation we check the size more precisely.\n \t */\n-\tBUILD_BUG_ON(offsetofend(typeof(*prph_scratch), dram.common) +\n+\tBUILD_BUG_ON(struct_offsetofend(prph_scratch, dram.common) +\n \t\t sizeof(prph_scratch-\u003edram.fseq_img) !=\n \t\t sizeof(*prph_scratch));\n \tif (control_flags_ext \u0026 IWL_PRPH_SCRATCH_EXT_EXT_FSEQ)\n@@ -249,8 +249,7 @@ int iwl_pcie_ctxt_info_v2_alloc(struct iwl_trans *trans,\n \t\t\tcpu_to_le32(sizeof(*prph_scratch));\n \telse\n \t\tctxt_info_v2-\u003eprph_scratch_size =\n-\t\t\tcpu_to_le32(offsetofend(typeof(*prph_scratch),\n-\t\t\t\t\t\tdram.common));\n+\t\t\tcpu_to_le32(struct_offsetofend(prph_scratch, dram.common));\n \n \tctxt_info_v2-\u003ecr_head_idx_arr_base_addr =\n \t\tcpu_to_le64(trans_pcie-\u003erxq-\u003erb_stts_dma);\ndiff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c\nindex 3d0c22db30a804..79b4bb78b17ab5 100644\n--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c\n+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c\n@@ -6167,7 +6167,7 @@ static void rtl8xxxu_c2hcmd_callback(struct work_struct *work)\n \t\tcase C2H_8723B_RA_REPORT:\n \t\t\tbw = rarpt-\u003etxrate.bw;\n \n-\t\t\tif (skb-\u003elen \u003e= offsetofend(typeof(*c2h), ra_report.bw)) {\n+\t\t\tif (skb-\u003elen \u003e= struct_offsetofend(c2h, ra_report.bw)) {\n \t\t\t\tif (c2h-\u003era_report.bw == RTL8XXXU_CHANNEL_WIDTH_40)\n \t\t\t\t\tbw = RATE_INFO_BW_40;\n \t\t\t\telse\ndiff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c\nindex 945fedcd375b62..d1a1a492d14674 100644\n--- a/drivers/net/wireless/realtek/rtw88/fw.c\n+++ b/drivers/net/wireless/realtek/rtw88/fw.c\n@@ -159,7 +159,7 @@ static void rtw_fw_ra_report_iter(void *data, struct ieee80211_sta *sta)\n \n \trate = u8_get_bits(ra_rpt-\u003erate_sgi, RTW_C2H_RA_RPT_RATE);\n \tsgi = u8_get_bits(ra_rpt-\u003erate_sgi, RTW_C2H_RA_RPT_SGI);\n-\tif (ra_data-\u003elength \u003e= offsetofend(typeof(*ra_rpt), bw))\n+\tif (ra_data-\u003elength \u003e= struct_offsetofend(ra_rpt, bw))\n \t\tbw = ra_rpt-\u003ebw;\n \telse\n \t\tbw = si-\u003ebw_mode;\ndiff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c\nindex 5220f74d15d2c0..85b04a61092085 100644\n--- a/drivers/net/wireless/realtek/rtw89/core.c\n+++ b/drivers/net/wireless/realtek/rtw89/core.c\n@@ -2605,7 +2605,7 @@ static void rtw89_vif_sync_bcn_tsf(struct rtw89_vif_link *rtwvif_link,\n {\n \tstruct ieee80211_mgmt *mgmt = (typeof(mgmt))hdr;\n \n-\tif (len \u003c offsetof(typeof(*mgmt), u.beacon.variable))\n+\tif (len \u003c struct_offset(mgmt, u.beacon.variable))\n \t\treturn;\n \n \tWRITE_ONCE(rtwvif_link-\u003esync_bcn_tsf, le64_to_cpu(mgmt-\u003eu.beacon.timestamp));\ndiff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c\nindex 21b548c63c7836..a4b6514a0ce5ff 100644\n--- a/drivers/net/wireless/realtek/rtw89/fw.c\n+++ b/drivers/net/wireless/realtek/rtw89/fw.c\n@@ -8067,11 +8067,11 @@ int rtw89_fw_h2c_scan_list_offload_be(struct rtw89_dev *rtwdev, int ch_num,\n \n \tif (RTW89_CHK_FW_FEATURE(CH_INFO_BE_V0, \u0026rtwdev-\u003efw)) {\n \t\tver = 0;\n-\t\telem_size = offsetofend(typeof(*elem), w7);\n+\t\telem_size = struct_offsetofend(elem, w7);\n \t\tused_len = sizeof(*h2c) + elem_size * ch_num;\n \t} else if (RTW89_CHK_FW_FEATURE(CH_INFO_BE_V1, \u0026rtwdev-\u003efw)) {\n \t\tver = 1;\n-\t\telem_size = offsetofend(typeof(*elem), w7);\n+\t\telem_size = struct_offsetofend(elem, w7);\n \t\tused_len = sizeof(*h2c) + elem_size * ch_num;\n \t}\n \n@@ -8350,10 +8350,10 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,\n \trtw89_scan_get_6g_disabled_chan(rtwdev, option);\n \n \tif (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V0, \u0026rtwdev-\u003efw)) {\n-\t\tcfg_len = offsetofend(typeof(*h2c), w8);\n+\t\tcfg_len = struct_offsetofend(h2c, w8);\n \t\tscan_offload_ver = 0;\n \t} else if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V1, \u0026rtwdev-\u003efw)) {\n-\t\tcfg_len = offsetofend(typeof(*h2c), w9);\n+\t\tcfg_len = struct_offsetofend(h2c, w9);\n \t\tscan_offload_ver = 1;\n \t} else if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V2, \u0026rtwdev-\u003efw)) {\n \t\tscan_offload_ver = 2;\ndiff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c\nindex 49ec2948c68ab7..f1c3938b429a8f 100644\n--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c\n+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c\n@@ -1622,12 +1622,12 @@ static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,\n \tif (txrate)\n \t\tbitrate = txrate-\u003ebitrate;\n \n-\tif (skb-\u003elen \u003e= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) \u0026\u0026\n+\tif (skb-\u003elen \u003e= struct_offsetofend(mgmt, u.probe_resp.timestamp) \u0026\u0026\n \t ieee80211_is_probe_resp(hdr-\u003eframe_control)) {\n \t\tmgmt-\u003eu.probe_resp.timestamp =\n \t\t\tcpu_to_le64(sim_time + data-\u003etsf_offset +\n \t\t\t\t 24 * 8 * 10 / bitrate);\n-\t} else if (skb-\u003elen \u003e= offsetofend(typeof(*mgmt), u.beacon.timestamp) \u0026\u0026\n+\t} else if (skb-\u003elen \u003e= struct_offsetofend(mgmt, u.beacon.timestamp) \u0026\u0026\n \t\t ieee80211_is_beacon(mgmt-\u003eframe_control)) {\n \t\tmgmt-\u003eu.beacon.timestamp = cpu_to_le64(sim_time +\n \t\t\t\t\t\t data-\u003etsf_offset +\ndiff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c\nindex 96dde19b15fa7a..df2a0dfe7cc3d5 100644\n--- a/drivers/platform/chrome/cros_ec_lightbar.c\n+++ b/drivers/platform/chrome/cros_ec_lightbar.c\n@@ -460,7 +460,7 @@ static ssize_t sequence_store(struct device *dev, struct device_attribute *attr,\n \tparam = (struct ec_params_lightbar *)msg-\u003edata;\n \tparam-\u003ecmd = LIGHTBAR_CMD_SEQ;\n \tparam-\u003eseq.num = num;\n-\tmsg-\u003eoutsize = offsetof(typeof(*param), seq) + sizeof(param-\u003eseq);\n+\tmsg-\u003eoutsize = struct_offset(param, seq) + sizeof(param-\u003eseq);\n \tmsg-\u003einsize = 0;\n \tret = lb_throttle();\n \tif (ret)\n@@ -508,7 +508,7 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,\n \t\t * Bound the payload strictly by the maximum value the structural\n \t\t * size field can natively support.\n \t\t */\n-\t\textra_bytes = offsetof(typeof(*param), set_program_ex) +\n+\t\textra_bytes = struct_offset(param, set_program_ex) +\n \t\t\tsizeof(param-\u003eset_program_ex);\n \t\tmax_size = min_t(size_t, ec-\u003eec_dev-\u003emax_request - extra_bytes,\n \t\t\t\t type_max(typeof(param-\u003eset_program_ex.size)));\ndiff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c\nindex 20b1aef455c4f4..159daefd249ed2 100644\n--- a/drivers/scsi/qla2xxx/qla_gs.c\n+++ b/drivers/scsi/qla2xxx/qla_gs.c\n@@ -185,7 +185,7 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,\n \t\t\t\t comp_status, ct_rsp-\u003eheader.response);\n \t\t\t\tql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha,\n \t\t\t\t 0x2078, ct_rsp,\n-\t\t\t\t offsetof(typeof(*ct_rsp), rsp));\n+\t\t\t\t struct_offset(ct_rsp, rsp));\n \t\t\t\trval = QLA_INVALID_COMMAND;\n \t\t\t} else\n \t\t\t\trval = QLA_SUCCESS;\ndiff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c\nindex 59ec5605930b7d..251c95d62fd015 100644\n--- a/drivers/scsi/qla2xxx/qla_mbx.c\n+++ b/drivers/scsi/qla2xxx/qla_mbx.c\n@@ -3225,7 +3225,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,\n \tmbx_cmd_t mc;\n \tmbx_cmd_t *mcp = \u0026mc;\n \tuint32_t *iter = (uint32_t *)stats;\n-\tushort dwords = offsetof(typeof(*stats), link_up_cnt)/sizeof(*iter);\n+\tushort dwords = struct_offset(stats, link_up_cnt) / sizeof(*iter);\n \tstruct qla_hw_data *ha = vha-\u003ehw;\n \n \tql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1084,\ndiff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c\nindex 3c412c7fb6fe76..8e6a953dc3f762 100644\n--- a/drivers/scsi/qla2xxx/qla_os.c\n+++ b/drivers/scsi/qla2xxx/qla_os.c\n@@ -6263,7 +6263,7 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha,\n \n \tif (qla25xx_rdp_rsp_reduce_size(vha, purex)) {\n \t\trsp_payload_length =\n-\t\t offsetof(typeof(*rsp_payload), optical_elmt_desc);\n+\t\t struct_offset(rsp_payload, optical_elmt_desc);\n \t\tql_dbg(ql_dbg_init, vha, 0x0181,\n \t\t \"Reducing RSP payload length to %u bytes...\\n\",\n \t\t rsp_payload_length);\ndiff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c\nindex f96b9eb15126b4..814988895620b9 100644\n--- a/drivers/scsi/qla2xxx/qla_tmpl.c\n+++ b/drivers/scsi/qla2xxx/qla_tmpl.c\n@@ -7,7 +7,7 @@\n #include \"qla_tmpl.h\"\n \n #define ISPREG(vha)\t(\u0026(vha)-\u003ehw-\u003eiobase-\u003eisp24)\n-#define IOBAR(reg)\toffsetof(typeof(*(reg)), iobase_addr)\n+#define IOBAR(reg)\tstruct_offset(reg, iobase_addr)\n #define IOBASE(vha)\tIOBAR(ISPREG(vha))\n #define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL)\n \n@@ -722,7 +722,7 @@ static struct qla27xx_fwdt_entry *\n qla27xx_fwdt_entry_t275(struct scsi_qla_host *vha,\n \tstruct qla27xx_fwdt_entry *ent, void *buf, ulong *len)\n {\n-\tulong offset = offsetof(typeof(*ent), t275.buffer);\n+\tulong offset = struct_offset(ent, t275.buffer);\n \tulong length = le32_to_cpu(ent-\u003et275.length);\n \tulong size = le32_to_cpu(ent-\u003ehdr.size);\n \tvoid *buffer = ent-\u003et275.buffer;\ndiff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c\nindex bec6ca38375bd6..09ee87ebd5d1a5 100644\n--- a/drivers/scsi/scsi_transport_fc.c\n+++ b/drivers/scsi/scsi_transport_fc.c\n@@ -570,7 +570,7 @@ fc_host_post_fc_event(struct Scsi_Host *shost, u32 event_number,\n \tevent-\u003eevent_code = event_code;\n \tif (data_len)\n \t\tmemcpy(event-\u003eevent_data_flex, data_buf, data_len);\n-\tpadding = len - offsetof(typeof(*event), event_data_flex) - data_len;\n+\tpadding = len - struct_offset(event, event_data_flex) - data_len;\n \tmemset(event-\u003eevent_data_flex + data_len, 0, padding);\n \n \tnlmsg_multicast(scsi_nl_sock, skb, 0, SCSI_NL_GRP_FC_EVENTS,\ndiff --git a/fs/readdir.c b/fs/readdir.c\nindex f2288841337ad1..858ee501d4f735 100644\n--- a/fs/readdir.c\n+++ b/fs/readdir.c\n@@ -22,7 +22,7 @@\n #include \u003clinux/compat.h\u003e\n #include \u003clinux/uaccess.h\u003e\n \n-#define dirent_size(dirent, len) offsetof(typeof(*(dirent)), d_name[len])\n+#define dirent_size(dirent, len) struct_offset(dirent, d_name[len])\n \n /*\n * Some filesystems were never converted to '-\u003eiterate_shared()'\ndiff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c\nindex 68f05a52605f4f..a777c5ee6dc944 100644\n--- a/fs/smb/client/cifssmb.c\n+++ b/fs/smb/client/cifssmb.c\n@@ -3200,7 +3200,7 @@ struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data,\n \tio_req-\u003eParameterCount = io_req-\u003eTotalParameterCount;\n \tio_req-\u003eParameterOffset = cpu_to_le32(0);\n \tio_req-\u003eDataCount = io_req-\u003eTotalDataCount;\n-\tio_req-\u003eDataOffset = cpu_to_le32(offsetof(typeof(*io_req), Data));\n+\tio_req-\u003eDataOffset = cpu_to_le32(struct_offset(io_req, Data));\n \tio_req-\u003eSetupCount = 4;\n \tio_req-\u003eSubCommand = cpu_to_le16(NT_TRANSACT_IOCTL);\n \tio_req-\u003eFunctionCode = cpu_to_le32(FSCTL_SET_REPARSE_POINT);\n@@ -5973,7 +5973,7 @@ int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,\n \tparam_offset = offsetof(struct smb_com_transaction2_spi_req,\n \t\t\t\tInformationLevel);\n \toffset = param_offset + params;\n-\tdata_offset = (char *)pSMB + offsetof(typeof(*pSMB), hdr.Protocol) + offset;\n+\tdata_offset = (char *)pSMB + struct_offset(pSMB, hdr.Protocol) + offset;\n \tpSMB-\u003eParameterOffset = cpu_to_le16(param_offset);\n \tpSMB-\u003eDataOffset = cpu_to_le16(offset);\n \tpSMB-\u003eSetupCount = 1;\ndiff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c\nindex 3a27773186ae43..ac6db460a942a3 100644\n--- a/fs/smb/client/reparse.c\n+++ b/fs/smb/client/reparse.c\n@@ -1042,7 +1042,8 @@ static int parse_reparse_wsl_symlink(struct reparse_wsl_symlink_data_buffer *buf\n \t\t\t\t struct cifs_open_info_data *data)\n {\n \tint len = le16_to_cpu(buf-\u003eReparseDataLength);\n-\tint data_offset = offsetof(typeof(*buf), Target) - offsetof(typeof(*buf), Version);\n+\tint data_offset = struct_offset(buf, Target) - struct_offset(buf,\n+\t\t\t\t\t\t\t\t Version);\n \tint symname_utf8_len;\n \t__le16 *symname_utf16;\n \tint symname_utf16_len;\ndiff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c\nindex f909e2b25158a8..78e836ef76eeeb 100644\n--- a/fs/xfs/scrub/attr.c\n+++ b/fs/xfs/scrub/attr.c\n@@ -306,7 +306,7 @@ xchk_xattr_local_entry(\n \tchar\t\t\t\t*name_end;\n \tunsigned int\t\t\tnamesize;\n \n-\tname_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]);\n+\tname_end = (char *)lentry + struct_offset(lentry, nameval[0]);\n \tif (name_end \u003e buf_end) {\n \t\txchk_da_set_corrupt(ds, level);\n \t\treturn 0;\n@@ -341,7 +341,7 @@ xchk_xattr_remote_entry(\n \tchar\t\t\t\t*name_end;\n \tunsigned int\t\t\tnamesize;\n \n-\tname_end = (char *)rentry + offsetof(typeof(*rentry), name[0]);\n+\tname_end = (char *)rentry + struct_offset(rentry, name[0]);\n \tif (name_end \u003e buf_end) {\n \t\txchk_da_set_corrupt(ds, level);\n \t\treturn 0;\ndiff --git a/fs/xfs/scrub/attr_repair.c b/fs/xfs/scrub/attr_repair.c\nindex 720090895c20f5..901f9a126e65cb 100644\n--- a/fs/xfs/scrub/attr_repair.c\n+++ b/fs/xfs/scrub/attr_repair.c\n@@ -294,7 +294,7 @@ xrep_xattr_salvage_local_attr(\n \t * Decode the leaf local entry format. If something seems wrong, we\n \t * junk the attribute.\n \t */\n-\tname_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]);\n+\tname_end = (char *)lentry + struct_offset(lentry, nameval[0]);\n \tif (name_end \u003e buf_end)\n \t\treturn 0;\n \tvalue = \u0026lentry-\u003enameval[lentry-\u003enamelen];\n@@ -348,7 +348,7 @@ xrep_xattr_salvage_remote_attr(\n \t * junk the attribute. Note that we should never find a zero-length\n \t * remote attribute value.\n \t */\n-\tname_end = (char *)rentry + offsetof(typeof(*rentry), name[0]);\n+\tname_end = (char *)rentry + struct_offset(rentry, name[0]);\n \tif (name_end \u003e buf_end)\n \t\treturn 0;\n \tnamesize = xfs_attr_leaf_entsize_remote(rentry-\u003enamelen);\ndiff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c\nindex d99e2a73272306..a90dcc92ca9754 100644\n--- a/fs/xfs/scrub/dir.c\n+++ b/fs/xfs/scrub/dir.c\n@@ -364,7 +364,7 @@ xchk_dir_check_entry(\n \tunsigned int\t\t\tadvance;\n \n \t/* must have namelen */\n-\tadvance = offsetof(typeof(*dep), name);\n+\tadvance = struct_offset(dep, name);\n \tif (iter_off + advance \u003e= end) {\n \t\txchk_fblock_set_corrupt(ds-\u003esc, XFS_DATA_FORK, rec_bno);\n \t\treturn -1;\n@@ -464,7 +464,7 @@ xchk_dir_rec(\n \t\tint\t\t\t\tadvance;\n \n \t\t/* must have freetag */\n-\t\tadvance = offsetof(typeof(*dup), length);\n+\t\tadvance = struct_offset(dup, length);\n \t\tif (iter_off + advance \u003e= end) {\n \t\t\txchk_fblock_set_corrupt(ds-\u003esc, XFS_DATA_FORK, rec_bno);\n \t\t\tgoto out_relse;\ndiff --git a/fs/xfs/scrub/dir_repair.c b/fs/xfs/scrub/dir_repair.c\nindex 518e15d93d3b42..c7d234b592c217 100644\n--- a/fs/xfs/scrub/dir_repair.c\n+++ b/fs/xfs/scrub/dir_repair.c\n@@ -501,7 +501,7 @@ xrep_dir_recover_entry(\n \tint\t\t\t\terror;\n \n \t/* must have namelen */\n-\tadvance = offsetof(typeof(*dep), name);\n+\tadvance = struct_offset(dep, name);\n \tif (offset + advance \u003e= end)\n \t\treturn 0;\n \n@@ -546,7 +546,7 @@ xrep_dir_recover_data(\n \t\t\treturn error;\n \n \t\t/* must have freetag */\n-\t\tadvance = offsetof(typeof(*dup), length);\n+\t\tadvance = struct_offset(dup, length);\n \t\tif (offset + advance \u003e= end)\n \t\t\tbreak;\n \ndiff --git a/include/linux/overflow.h b/include/linux/overflow.h\nindex d0f04436343e5f..c029d68daeca1b 100644\n--- a/include/linux/overflow.h\n+++ b/include/linux/overflow.h\n@@ -464,6 +464,18 @@ static __always_inline size_t __must_check size_sub(size_t minuend, size_t subtr\n */\n #define struct_offset(p, member) (offsetof(typeof(*(p)), member))\n \n+/**\n+ * struct_offsetofend() - Calculate the end of a member within a struct\n+ * @p: Pointer to the struct\n+ * @member: Name of the member to get the end offset of\n+ *\n+ * Calculates the offset of the end of a particular @member of the structure\n+ * pointed to by @p.\n+ *\n+ * Return: number of bytes to the end of @member.\n+ */\n+#define struct_offsetofend(p, member) (offsetofend(typeof(*(p)), member))\n+\n /**\n * __DEFINE_FLEX() - helper macro for DEFINE_FLEX() family.\n * Enables caller macro to pass arbitrary trailing expressions\ndiff --git a/kernel/futex/core.c b/kernel/futex/core.c\nindex a240638f69e5c6..a7ef407e1e93a3 100644\n--- a/kernel/futex/core.c\n+++ b/kernel/futex/core.c\n@@ -388,7 +388,8 @@ __futex_hash(union futex_key *key, struct futex_private_hash *fph, struct futex_\n \t}\n #endif\n \n-\thash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / sizeof(u32),\n+\thash = jhash2((u32 *)key,\n+\t\t struct_offset(key, both.offset) / sizeof(u32),\n \t\t key-\u003eboth.offset);\n \n \tif (node == FUTEX_NO_NODE) {\ndiff --git a/net/bpf/test_run.c b/net/bpf/test_run.c\nindex d6c9dc62182ee4..519c4de7cfe2b9 100644\n--- a/net/bpf/test_run.c\n+++ b/net/bpf/test_run.c\n@@ -1613,7 +1613,7 @@ int bpf_prog_test_run_sk_lookup(struct bpf_prog *prog, const union bpf_attr *kat\n \tif (user_ctx-\u003esk)\n \t\tgoto out;\n \n-\tif (!range_is_zero(user_ctx, offsetofend(typeof(*user_ctx), local_port), sizeof(*user_ctx)))\n+\tif (!range_is_zero(user_ctx, struct_offsetofend(user_ctx, local_port), sizeof(*user_ctx)))\n \t\tgoto out;\n \n \tif (user_ctx-\u003elocal_port \u003e U16_MAX) {\ndiff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c\nindex d42d776af273e4..0db29c6fd3d3ca 100644\n--- a/net/ipv4/ip_output.c\n+++ b/net/ipv4/ip_output.c\n@@ -451,8 +451,8 @@ EXPORT_SYMBOL(ip_output);\n */\n static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4)\n {\n-\tBUILD_BUG_ON(offsetof(typeof(*fl4), daddr) !=\n-\t\t offsetof(typeof(*fl4), saddr) + sizeof(fl4-\u003esaddr));\n+\tBUILD_BUG_ON(struct_offset(fl4, daddr) !=\n+\t\t struct_offset(fl4, saddr) + sizeof(fl4-\u003esaddr));\n \n \tiph-\u003esaddr = fl4-\u003esaddr;\n \tiph-\u003edaddr = fl4-\u003edaddr;\ndiff --git a/net/ipv4/udp.c b/net/ipv4/udp.c\nindex 2e5562f353f85d..3dfb60b67fe980 100644\n--- a/net/ipv4/udp.c\n+++ b/net/ipv4/udp.c\n@@ -2526,7 +2526,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,\n \thash2 = 0;\n \thslot = udp_hashslot(udptable, net, hnum);\n \tuse_hash2 = hslot-\u003ecount \u003e 10;\n-\toffset = offsetof(typeof(*sk), sk_node);\n+\toffset = struct_offset(sk, sk_node);\n \n \tif (use_hash2) {\n \t\thash2_any = ipv4_portaddr_hash(net, htonl(INADDR_ANY), hnum) \u0026\n@@ -2534,7 +2534,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,\n \t\thash2 = ipv4_portaddr_hash(net, daddr, hnum) \u0026 udptable-\u003emask;\n start_lookup:\n \t\thslot = \u0026udptable-\u003ehash2[hash2].hslot;\n-\t\toffset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);\n+\t\toffset = struct_offset(sk, __sk_common.skc_portaddr_node);\n \t}\n \n \tsk_for_each_entry_offset_rcu(sk, node, \u0026hslot-\u003ehead, offset) {\ndiff --git a/net/ipv6/udp.c b/net/ipv6/udp.c\nindex 9dcefa16252235..6b396a4eb2b953 100644\n--- a/net/ipv6/udp.c\n+++ b/net/ipv6/udp.c\n@@ -962,7 +962,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,\n \thash2 = 0;\n \thslot = udp_hashslot(udptable, net, hnum);\n \tuse_hash2 = hslot-\u003ecount \u003e 10;\n-\toffset = offsetof(typeof(*sk), sk_node);\n+\toffset = struct_offset(sk, sk_node);\n \n \tif (use_hash2) {\n \t\thash2_any = ipv6_portaddr_hash(net, \u0026in6addr_any, hnum) \u0026\n@@ -970,7 +970,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,\n \t\thash2 = ipv6_portaddr_hash(net, daddr, hnum) \u0026 udptable-\u003emask;\n start_lookup:\n \t\thslot = \u0026udptable-\u003ehash2[hash2].hslot;\n-\t\toffset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);\n+\t\toffset = struct_offset(sk, __sk_common.skc_portaddr_node);\n \t}\n \n \tsk_for_each_entry_offset_rcu(sk, node, \u0026hslot-\u003ehead, offset) {\ndiff --git a/net/key/af_key.c b/net/key/af_key.c\nindex d215b33b7492c2..20016a2770f789 100644\n--- a/net/key/af_key.c\n+++ b/net/key/af_key.c\n@@ -384,7 +384,7 @@ static int verify_address_len(const void *p)\n \tint len;\n \n \tif (sp-\u003esadb_address_len \u003c\n-\t DIV_ROUND_UP(sizeof(*sp) + offsetofend(typeof(*addr), sa_family),\n+\t DIV_ROUND_UP(sizeof(*sp) + struct_offsetofend(addr, sa_family),\n \t\t\t sizeof(uint64_t)))\n \t\treturn -EINVAL;\n \ndiff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c\nindex 01d6703767c638..72f78c4a58d424 100644\n--- a/net/mac80211/agg-rx.c\n+++ b/net/mac80211/agg-rx.c\n@@ -493,8 +493,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,\n \t\tieee80211_retrieve_addba_ext_data(sta,\n \t\t\t\t\t\t mgmt-\u003eu.action.addba_req.variable,\n \t\t\t\t\t\t len -\n-\t\t\t\t\t\t offsetof(typeof(*mgmt),\n-\t\t\t\t\t\t\t u.action.addba_req.variable),\n+\t\t\t\t\t\t struct_offset(mgmt, u.action.addba_req.variable),\n \t\t\t\t\t\t \u0026buf_size);\n \n \t__ieee80211_start_rx_ba_session(sta, dialog_token, timeout,\ndiff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c\nindex f3ecdd8601a042..58a13cddee2e85 100644\n--- a/net/mac80211/agg-tx.c\n+++ b/net/mac80211/agg-tx.c\n@@ -990,8 +990,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,\n \n \tieee80211_retrieve_addba_ext_data(sta,\n \t\t\t\t\t mgmt-\u003eu.action.addba_resp.variable,\n-\t\t\t\t\t len - offsetof(typeof(*mgmt),\n-\t\t\t\t\t\t\t u.action.addba_resp.variable),\n+\t\t\t\t\t len - struct_offset(mgmt, u.action.addba_resp.variable),\n \t\t\t\t\t \u0026buf_size);\n \n \tbuf_size = min(buf_size, local-\u003ehw.max_tx_aggregation_subframes);\ndiff --git a/net/mac80211/parse.c b/net/mac80211/parse.c\nindex f3c5a9f6ec7c0e..e5a752e674f795 100644\n--- a/net/mac80211/parse.c\n+++ b/net/mac80211/parse.c\n@@ -1068,7 +1068,7 @@ ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params)\n \tbool inside_multilink = false;\n \n \tBUILD_BUG_ON(sizeof(empty_non_inheritance) != empty_non_inheritance[1] + 2);\n-\tBUILD_BUG_ON(offsetof(typeof(*elems_parse), elems) != 0);\n+\tBUILD_BUG_ON(struct_offset(elems_parse, elems) != 0);\n \n \t/* cannot parse for both a specific link and non-transmitted BSS */\n \tif (WARN_ON(params-\u003elink_id \u003e= 0 \u0026\u0026 params-\u003ebss))\ndiff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c\nindex 8ae01c277fd265..eb2c034493c4f6 100644\n--- a/net/mac80211/tdls.c\n+++ b/net/mac80211/tdls.c\n@@ -1767,7 +1767,7 @@ ieee80211_process_tdls_channel_switch_resp(struct ieee80211_sub_if_data *sdata,\n \tstruct ieee80211_tdls_data *tf = (void *)skb-\u003edata;\n \tbool local_initiator;\n \tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\n-\tint baselen = offsetof(typeof(*tf), u.chan_switch_resp.variable);\n+\tint baselen = struct_offset(tf, u.chan_switch_resp.variable);\n \tstruct ieee80211_tdls_ch_sw_params params = {};\n \tint ret;\n \n@@ -1868,7 +1868,7 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,\n \tenum nl80211_band band;\n \tstruct ieee80211_tdls_data *tf = (void *)skb-\u003edata;\n \tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\n-\tint baselen = offsetof(typeof(*tf), u.chan_switch_req.variable);\n+\tint baselen = struct_offset(tf, u.chan_switch_req.variable);\n \tstruct ieee80211_tdls_ch_sw_params params = {};\n \tint ret = 0;\n \ndiff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c\nindex e7dd32880598fd..9b735caaf2b7e6 100644\n--- a/net/wireless/nl80211.c\n+++ b/net/wireless/nl80211.c\n@@ -333,7 +333,7 @@ static int validate_beacon_head(const struct nlattr *attr,\n \tunsigned int fixedlen, hdrlen;\n \tbool s1g_bcn;\n \n-\tif (len \u003c offsetofend(typeof(*mgmt), frame_control))\n+\tif (len \u003c struct_offsetofend(mgmt, frame_control))\n \t\tgoto err;\n \n \ts1g_bcn = ieee80211_is_s1g_beacon(mgmt-\u003eframe_control);\ndiff --git a/net/wireless/reg.c b/net/wireless/reg.c\nindex 5cd3880ee3841d..4fc1bf251c15d8 100644\n--- a/net/wireless/reg.c\n+++ b/net/wireless/reg.c\n@@ -707,7 +707,7 @@ static bool valid_country(const u8 *data, unsigned int size,\n \tunsigned int i;\n \n \t/* make sure we can read len/n_rules */\n-\tif ((u8 *)coll + offsetofend(typeof(*coll), n_rules) \u003e data + size)\n+\tif ((u8 *)coll + struct_offsetofend(coll, n_rules) \u003e data + size)\n \t\treturn false;\n \n \t/* make sure base struct and all rules fit */\ndiff --git a/net/wireless/scan.c b/net/wireless/scan.c\nindex 1c50a16c0e9bea..28a46d49de04f8 100644\n--- a/net/wireless/scan.c\n+++ b/net/wireless/scan.c\n@@ -587,7 +587,7 @@ static int cfg80211_parse_ap_info(struct cfg80211_colocated_ap *entry,\n \t\tbss_params = tbtt_info-\u003ebss_params;\n \n \t\t/* Ignore disabled links */\n-\t\tif (length \u003e= offsetofend(typeof(*tbtt_info), mld_params)) {\n+\t\tif (length \u003e= struct_offsetofend(tbtt_info, mld_params)) {\n \t\t\tif (le16_get_bits(tbtt_info-\u003emld_params.params,\n \t\t\t\t\t IEEE80211_RNR_MLD_PARAMS_DISABLED_LINK))\n \t\t\t\treturn -EINVAL;\ndiff --git a/scripts/coccinelle/api/struct_offsetof.cocci b/scripts/coccinelle/api/struct_offsetof.cocci\nnew file mode 100644\nindex 00000000000000..5a30647d378720\n--- /dev/null\n+++ b/scripts/coccinelle/api/struct_offsetof.cocci\n@@ -0,0 +1,18 @@\n+// SPDX-License-Identifier: GPL-2.0-only\n+/// Use struct_offset() family of macros\n+///\n+// Confidence: High\n+// Options: --no-includes --ignore ./tools/\n+\n+virtual patch\n+\n+@offsetof depends on patch@\n+expression ptr, member;\n+@@\n+- offsetof(typeof(*(ptr)), member)\n++ struct_offset(ptr, member)\n+@offsetofend depends on patch@\n+expression ptr, member;\n+@@\n+- offsetofend(typeof(*(ptr)), member)\n++ struct_offsetofend(ptr, member)\ndiff --git a/security/landlock/net.c b/security/landlock/net.c\nindex 8fd73cf4bd15b4..2f4bbd3bfe27c0 100644\n--- a/security/landlock/net.c\n+++ b/security/landlock/net.c\n@@ -93,7 +93,7 @@ static int current_check_access_socket(struct socket *const sock,\n \t\treturn 0;\n \n \t/* Checks for minimal header length to safely read sa_family. */\n-\tif (addrlen \u003c (int)offsetofend(typeof(*address), sa_family))\n+\tif (addrlen \u003c (int)struct_offsetofend(address, sa_family))\n \t\treturn -EINVAL;\n \n \t/*\n@@ -382,7 +382,7 @@ static int hook_socket_connect(struct socket *const sock,\n \t * should never be restricted.\n \t */\n \tif (ret == 0 \u0026\u0026 sk_is_udp(sock-\u003esk) \u0026\u0026\n-\t addrlen \u003e= offsetofend(typeof(*address), sa_family) \u0026\u0026\n+\t addrlen \u003e= struct_offsetofend(address, sa_family) \u0026\u0026\n \t address-\u003esa_family != AF_UNSPEC)\n \t\tret = current_check_autobind_udp_socket(sock);\n \ndiff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c\nindex ed5fe746d43856..6e4f56a06aed6d 100644\n--- a/sound/usb/mixer_scarlett2.c\n+++ b/sound/usb/mixer_scarlett2.c\n@@ -9656,7 +9656,7 @@ static long scarlett2_hwdep_write(struct snd_hwdep *hw,\n \n \t/* Calculate the maximum permitted in data[] */\n \tconst size_t max_data_size = SCARLETT2_FLASH_RW_MAX -\n-\t\t\t\t offsetof(typeof(*req), data);\n+\t\t\t\t struct_offset(req, data);\n \n \t/* If erasing, wait for it to complete */\n \tif (private-\u003eflash_write_state ==\n"
} |
| 2/1 | 2026/11/22 12:50 | agent | patch-evaluator |
7mModel:core Args: null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"SECURITY",
"SECURITY_LANDLOCK",
"NET_KEY",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"INET"
],
"FocusSymbols": [
"bpf_prog_test_run_sk_lookup",
"verify_address_len",
"hook_socket_connect",
"ieee80211_process_addba_request",
"ieee80211_process_addba_resp",
"validate_beacon_head",
"mac80211_hwsim_write_tsf",
"__udp4_lib_mcast_deliver"
],
"Reasoning": "The patch introduces the struct_offsetofend macro helper and refactors offset calculations across multiple reachable core subsystems, including BPF syscall test runs, Landlock security hooks, AF_KEY socket validation, mac80211 wireless protocol frame handling, and UDP multicast delivery. Even though intended as a refactoring/cleanup, modifying offset calculations in reachable core networking, security, and BPF code warrants fuzzing to ensure no regressions or boundary evaluation discrepancies occur.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit e9ed11040ab7cc34826cc8cae2ae50d9d266f3ed
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Nov 22 12:50:26 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index d449fbdde46406..cd98beaf6cb6ef 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -81,7 +81,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
struct btmrvl_event *event;
int ret = 0;
- if (skb->len <= offsetof(typeof(*event), data[0]))
+ if (skb->len <= struct_offset(event, data[0]))
return -EINVAL;
event = (struct btmrvl_event *) skb->data;
@@ -92,7 +92,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
switch (event->data[0]) {
case BT_EVENT_AUTO_SLEEP_MODE:
- if (skb->len <= offsetof(typeof(*event), data[2]))
+ if (skb->len <= struct_offset(event, data[2]))
return -EINVAL;
if (!event->data[2]) {
if (event->data[1] == BT_PS_ENABLE)
@@ -107,7 +107,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_HOST_SLEEP_CONFIG:
- if (skb->len <= offsetof(typeof(*event), data[3]))
+ if (skb->len <= struct_offset(event, data[3]))
return -EINVAL;
if (!event->data[3])
BT_DBG("gpio=%x, gap=%x", event->data[1],
@@ -117,7 +117,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_HOST_SLEEP_ENABLE:
- if (skb->len <= offsetof(typeof(*event), data[1]))
+ if (skb->len <= struct_offset(event, data[1]))
return -EINVAL;
if (!event->data[1]) {
adapter->hs_state = HS_ACTIVATED;
@@ -131,7 +131,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_MODULE_CFG_REQ:
- if (skb->len <= offsetof(typeof(*event), data[2]))
+ if (skb->len <= struct_offset(event, data[2]))
return -EINVAL;
if (priv->btmrvl_dev.sendcmdflag &&
event->data[1] == MODULE_BRINGUP_REQ) {
@@ -150,7 +150,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_POWER_STATE:
- if (skb->len <= offsetof(typeof(*event), data[1]))
+ if (skb->len <= struct_offset(event, data[1]))
return -EINVAL;
if (event->data[1] == BT_PS_SLEEP)
adapter->ps_state = PS_SLEEP;
diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
index 2365a6d8ca15f6..a751a972aea17d 100644
--- a/drivers/dma-buf/dma-resv.c
+++ b/drivers/dma-buf/dma-resv.c
@@ -108,7 +108,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int max_fences)
return NULL;
/* Given the resulting bucket size, recalculated max_fences. */
- list->max_fences = (size - offsetof(typeof(*list), table)) /
+ list->max_fences = (size - struct_offset(list, table)) /
sizeof(*list->table);
return list;
diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c
index a9cea09355ff4b..12b8cceb3d200e 100644
--- a/drivers/firmware/arm_scmi/base.c
+++ b/drivers/firmware/arm_scmi/base.c
@@ -340,7 +340,7 @@ static void *scmi_base_fill_custom_report(const struct scmi_protocol_handle *ph,
if (evt_id != SCMI_EVENT_BASE_ERROR_EVENT || sizeof(*p) < payld_sz)
return NULL;
- expected_sz = offsetof(typeof(*p), msg_reports);
+ expected_sz = struct_offset(p, msg_reports);
if (payld_sz < expected_sz)
return NULL;
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b8f882a17c8f1d..e7dcaa1f2f58d6 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3124,9 +3124,9 @@ EXPORT_SYMBOL(drm_mode_find_dmt);
static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 type)
{
- BUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.pad1) != 2);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.type) != 3);
+ BUILD_BUG_ON(struct_offset(descriptor, pixel_clock) != 0);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.pad1) != 2);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.type) != 3);
return descriptor->pixel_clock == 0 &&
descriptor->data.other_data.pad1 == 0 &&
@@ -3135,7 +3135,7 @@ static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 t
static bool is_detailed_timing_descriptor(const struct detailed_timing *descriptor)
{
- BUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);
+ BUILD_BUG_ON(struct_offset(descriptor, pixel_clock) != 0);
return descriptor->pixel_clock != 0;
}
@@ -3207,8 +3207,8 @@ is_rb(const struct detailed_timing *descriptor, void *data)
if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
return;
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.cvt.flags) != 15);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.cvt.flags) != 15);
if (descriptor->data.other_data.data.range.flags == DRM_EDID_CVT_SUPPORT_FLAG &&
descriptor->data.other_data.data.range.formula.cvt.flags & DRM_EDID_CVT_FLAGS_REDUCED_BLANKING)
@@ -3237,7 +3237,7 @@ find_gtf2(const struct detailed_timing *descriptor, void *data)
if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
return;
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);
if (descriptor->data.other_data.data.range.flags == DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG)
*res = descriptor;
@@ -3251,7 +3251,9 @@ drm_gtf2_hbreak(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.hfreq_start_khz) != 12);
+ BUILD_BUG_ON(struct_offset(descriptor,
+ data.other_data.data.range.formula.gtf2.hfreq_start_khz
+ ) != 12);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.hfreq_start_khz * 2 : 0;
}
@@ -3263,7 +3265,7 @@ drm_gtf2_2c(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.c) != 13);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.c) != 13);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.c : 0;
}
@@ -3275,7 +3277,7 @@ drm_gtf2_m(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.m) != 14);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.m) != 14);
return descriptor ? le16_to_cpu(descriptor->data.other_data.data.range.formula.gtf2.m) : 0;
}
@@ -3287,7 +3289,7 @@ drm_gtf2_k(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.k) != 16);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.k) != 16);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.k : 0;
}
@@ -3299,7 +3301,7 @@ drm_gtf2_2j(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.j) != 17);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.j) != 17);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.j : 0;
}
@@ -3312,7 +3314,7 @@ get_timing_level(const struct detailed_timing *descriptor, void *data)
if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
return;
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);
switch (descriptor->data.other_data.data.range.flags) {
case DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG:
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 9e01f8b2079aba..598c1271cae198 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -101,8 +101,8 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
* A gem object is embedded both in a struct ttm_buffer_object :/ and
* in a drm_i915_gem_object. Make sure they are aliased.
*/
- BUILD_BUG_ON(offsetof(typeof(*obj), base) !=
- offsetof(typeof(*obj), __do_not_access.base));
+ BUILD_BUG_ON(struct_offset(obj, base) !=
+ struct_offset(obj, __do_not_access.base));
spin_lock_init(&obj->vma.lock);
INIT_LIST_HEAD(&obj->vma.list);
diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index b2442f05825ee2..48a773b3cde925 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -263,7 +263,7 @@ static struct active_node *__active_lookup(struct i915_active *ref, u64 idx)
return it;
}
- BUILD_BUG_ON(offsetof(typeof(*it), node));
+ BUILD_BUG_ON(struct_offset(it, node));
/* While active, the tree can only be built; not destroyed */
GEM_BUG_ON(i915_active_is_idle(ref));
diff --git a/drivers/gpu/drm/i915/i915_sw_fence_work.c b/drivers/gpu/drm/i915/i915_sw_fence_work.c
index 366418108f78f4..c059bb1e9492ef 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence_work.c
+++ b/drivers/gpu/drm/i915/i915_sw_fence_work.c
@@ -70,7 +70,7 @@ static void fence_release(struct dma_fence *fence)
i915_sw_fence_fini(&f->chain);
- BUILD_BUG_ON(offsetof(typeof(*f), dma));
+ BUILD_BUG_ON(struct_offset(f, dma));
dma_fence_free(&f->dma);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
index fe590a045d70af..279309d008f0c5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
@@ -1171,7 +1171,7 @@ r535_gsp_shared_init(struct nvkm_gsp *gsp)
cmdq->tx.msgCount = (cmdq->tx.size - cmdq->tx.entryOff) / cmdq->tx.msgSize;
cmdq->tx.writePtr = 0;
cmdq->tx.flags = 1;
- cmdq->tx.rxHdrOff = offsetof(typeof(*cmdq), rx.readPtr);
+ cmdq->tx.rxHdrOff = struct_offset(cmdq, rx.readPtr);
msgq = gsp->shm.msgq.ptr;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index a9136a6523cbac..247f6d9b449499 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2609,12 +2609,12 @@ static int vmw_cmd_dx_check_subresource(struct vmw_private *dev_priv,
};
} *cmd;
- BUILD_BUG_ON(offsetof(typeof(*cmd), r_body.sid) !=
- offsetof(typeof(*cmd), sid));
- BUILD_BUG_ON(offsetof(typeof(*cmd), i_body.sid) !=
- offsetof(typeof(*cmd), sid));
- BUILD_BUG_ON(offsetof(typeof(*cmd), u_body.sid) !=
- offsetof(typeof(*cmd), sid));
+ BUILD_BUG_ON(struct_offset(cmd, r_body.sid) !=
+ struct_offset(cmd, sid));
+ BUILD_BUG_ON(struct_offset(cmd, i_body.sid) !=
+ struct_offset(cmd, sid));
+ BUILD_BUG_ON(struct_offset(cmd, u_body.sid) !=
+ struct_offset(cmd, sid));
cmd = container_of(header, typeof(*cmd), header);
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index 5301e4f21ade0e..1662aeebf1349a 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -780,7 +780,7 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq,
srqe->wqe_type = wqe->type;
srqe->flags = wqe->flags;
srqe->wqe_size = wqe->num_sge +
- ((offsetof(typeof(*srqe), data) + 15) >> 4);
+ ((struct_offset(srqe, data) + 15) >> 4);
srqe->wr_id[0] = cpu_to_le32((u32)next);
srq->swq[next].wr_id = wqe->wr_id;
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c
index 7dfaa01cda670b..df4d57c4e85e36 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c
@@ -287,7 +287,7 @@ static int alloc_cq_db(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq,
if (udata) {
if (has_db &&
- udata->outlen >= offsetofend(typeof(*resp), cap_flags)) {
+ udata->outlen >= struct_offsetofend(resp, cap_flags)) {
uctx = rdma_udata_to_drv_context(udata,
struct hns_roce_ucontext, ibucontext);
err = hns_roce_db_map_user(uctx, addr, &hr_cq->db);
@@ -378,7 +378,7 @@ static int set_cqe_size(struct hns_roce_cq *hr_cq, struct ib_udata *udata,
return 0;
}
- if (udata->inlen >= offsetofend(typeof(*ucmd), cqe_size)) {
+ if (udata->inlen >= struct_offsetofend(ucmd, cqe_size)) {
if (ucmd->cqe_size != HNS_ROCE_V2_CQE_SIZE &&
ucmd->cqe_size != HNS_ROCE_V3_CQE_SIZE) {
ibdev_err(&hr_dev->ib_dev,
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index c6c0dfdbdbc303..e46c6cc1e3ee63 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -836,9 +836,9 @@ static inline bool user_qp_has_sdb(struct hns_roce_dev *hr_dev,
struct hns_roce_ib_create_qp *ucmd)
{
return ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_RECORD_DB) &&
- udata->outlen >= offsetofend(typeof(*resp), cap_flags) &&
+ udata->outlen >= struct_offsetofend(resp, cap_flags) &&
hns_roce_qp_has_sq(init_attr) &&
- udata->inlen >= offsetofend(typeof(*ucmd), sdb_addr));
+ udata->inlen >= struct_offsetofend(ucmd, sdb_addr));
}
static inline bool user_qp_has_rdb(struct hns_roce_dev *hr_dev,
@@ -847,7 +847,7 @@ static inline bool user_qp_has_rdb(struct hns_roce_dev *hr_dev,
struct hns_roce_ib_create_qp_resp *resp)
{
return ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_RECORD_DB) &&
- udata->outlen >= offsetofend(typeof(*resp), cap_flags) &&
+ udata->outlen >= struct_offsetofend(resp, cap_flags) &&
hns_roce_qp_has_rq(init_attr));
}
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 644c2f1cd8e634..4cf876f4b7eaae 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -1108,7 +1108,7 @@ static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,
static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,
struct uvc_xu_control_mapping32 __user *up)
{
- if (copy_to_user(up, kp, offsetof(typeof(*up), menu_info)) ||
+ if (copy_to_user(up, kp, struct_offset(up, menu_info)) ||
put_user(kp->menu_count, &up->menu_count))
return -EFAULT;
@@ -1147,7 +1147,7 @@ static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,
static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
struct uvc_xu_control_query32 __user *up)
{
- if (copy_to_user(up, kp, offsetof(typeof(*up), data)))
+ if (copy_to_user(up, kp, struct_offset(up, data)))
return -EFAULT;
return 0;
}
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 96225132750695..efebabd1ae04d9 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1041,7 +1041,7 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
set = &request->request_msg.msg.set_req;
set->oid = RNDIS_OID_GEN_CURRENT_PACKET_FILTER;
set->info_buflen = sizeof(u32);
- set->info_buf_offset = offsetof(typeof(*set), info_buf);
+ set->info_buf_offset = struct_offset(set, info_buf);
memcpy(set->info_buf, &new_filter, sizeof(u32));
ret = rndis_filter_send_request(dev, request);
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 0982e60842b1c6..01bdc0e9635d34 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -736,7 +736,7 @@ static void iwl_parse_dbg_tlv_assert_tables(struct iwl_drv *drv,
u32 length = le32_to_cpu(tlv->length);
u32 addr;
- if (length < offsetof(typeof(*region), special_mem) +
+ if (length < struct_offset(region, special_mem) +
sizeof(region->special_mem))
return;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index e2382be8edd78d..5faa97a420d8ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -625,7 +625,7 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
cfg_cmd.sta_id = mvm_link_sta->sta_id;
lq_sta = &mvm_link_sta->lq_sta.rs_fw;
- memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));
+ memset(lq_sta, 0, struct_offset(lq_sta, pers));
rcu_read_unlock();
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index d1619a229d8f2b..da0669155a3b08 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -2939,7 +2939,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
lockdep_assert_held(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
/* clear all non-persistent lq data */
- memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));
+ memset(lq_sta, 0, struct_offset(lq_sta, pers));
sband = hw->wiphy->bands[band];
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c
index 0009a05511af17..a5a065275f18dc 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c
@@ -241,7 +241,7 @@ int iwl_pcie_ctxt_info_v2_alloc(struct iwl_trans *trans,
* optional; old devices _should_ be fine with a bigger size,
* but in simulation we check the size more precisely.
*/
- BUILD_BUG_ON(offsetofend(typeof(*prph_scratch), dram.common) +
+ BUILD_BUG_ON(struct_offsetofend(prph_scratch, dram.common) +
sizeof(prph_scratch->dram.fseq_img) !=
sizeof(*prph_scratch));
if (control_flags_ext & IWL_PRPH_SCRATCH_EXT_EXT_FSEQ)
@@ -249,8 +249,7 @@ int iwl_pcie_ctxt_info_v2_alloc(struct iwl_trans *trans,
cpu_to_le32(sizeof(*prph_scratch));
else
ctxt_info_v2->prph_scratch_size =
- cpu_to_le32(offsetofend(typeof(*prph_scratch),
- dram.common));
+ cpu_to_le32(struct_offsetofend(prph_scratch, dram.common));
ctxt_info_v2->cr_head_idx_arr_base_addr =
cpu_to_le64(trans_pcie->rxq->rb_stts_dma);
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 3d0c22db30a804..79b4bb78b17ab5 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -6167,7 +6167,7 @@ static void rtl8xxxu_c2hcmd_callback(struct work_struct *work)
case C2H_8723B_RA_REPORT:
bw = rarpt->txrate.bw;
- if (skb->len >= offsetofend(typeof(*c2h), ra_report.bw)) {
+ if (skb->len >= struct_offsetofend(c2h, ra_report.bw)) {
if (c2h->ra_report.bw == RTL8XXXU_CHANNEL_WIDTH_40)
bw = RATE_INFO_BW_40;
else
diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index 945fedcd375b62..d1a1a492d14674 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -159,7 +159,7 @@ static void rtw_fw_ra_report_iter(void *data, struct ieee80211_sta *sta)
rate = u8_get_bits(ra_rpt->rate_sgi, RTW_C2H_RA_RPT_RATE);
sgi = u8_get_bits(ra_rpt->rate_sgi, RTW_C2H_RA_RPT_SGI);
- if (ra_data->length >= offsetofend(typeof(*ra_rpt), bw))
+ if (ra_data->length >= struct_offsetofend(ra_rpt, bw))
bw = ra_rpt->bw;
else
bw = si->bw_mode;
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 5220f74d15d2c0..85b04a61092085 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -2605,7 +2605,7 @@ static void rtw89_vif_sync_bcn_tsf(struct rtw89_vif_link *rtwvif_link,
{
struct ieee80211_mgmt *mgmt = (typeof(mgmt))hdr;
- if (len < offsetof(typeof(*mgmt), u.beacon.variable))
+ if (len < struct_offset(mgmt, u.beacon.variable))
return;
WRITE_ONCE(rtwvif_link->sync_bcn_tsf, le64_to_cpu(mgmt->u.beacon.timestamp));
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 21b548c63c7836..a4b6514a0ce5ff 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -8067,11 +8067,11 @@ int rtw89_fw_h2c_scan_list_offload_be(struct rtw89_dev *rtwdev, int ch_num,
if (RTW89_CHK_FW_FEATURE(CH_INFO_BE_V0, &rtwdev->fw)) {
ver = 0;
- elem_size = offsetofend(typeof(*elem), w7);
+ elem_size = struct_offsetofend(elem, w7);
used_len = sizeof(*h2c) + elem_size * ch_num;
} else if (RTW89_CHK_FW_FEATURE(CH_INFO_BE_V1, &rtwdev->fw)) {
ver = 1;
- elem_size = offsetofend(typeof(*elem), w7);
+ elem_size = struct_offsetofend(elem, w7);
used_len = sizeof(*h2c) + elem_size * ch_num;
}
@@ -8350,10 +8350,10 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
rtw89_scan_get_6g_disabled_chan(rtwdev, option);
if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V0, &rtwdev->fw)) {
- cfg_len = offsetofend(typeof(*h2c), w8);
+ cfg_len = struct_offsetofend(h2c, w8);
scan_offload_ver = 0;
} else if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V1, &rtwdev->fw)) {
- cfg_len = offsetofend(typeof(*h2c), w9);
+ cfg_len = struct_offsetofend(h2c, w9);
scan_offload_ver = 1;
} else if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V2, &rtwdev->fw)) {
scan_offload_ver = 2;
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
index 49ec2948c68ab7..f1c3938b429a8f 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
@@ -1622,12 +1622,12 @@ static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
if (txrate)
bitrate = txrate->bitrate;
- if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
+ if (skb->len >= struct_offsetofend(mgmt, u.probe_resp.timestamp) &&
ieee80211_is_probe_resp(hdr->frame_control)) {
mgmt->u.probe_resp.timestamp =
cpu_to_le64(sim_time + data->tsf_offset +
24 * 8 * 10 / bitrate);
- } else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
+ } else if (skb->len >= struct_offsetofend(mgmt, u.beacon.timestamp) &&
ieee80211_is_beacon(mgmt->frame_control)) {
mgmt->u.beacon.timestamp = cpu_to_le64(sim_time +
data->tsf_offset +
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index 96dde19b15fa7a..df2a0dfe7cc3d5 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -460,7 +460,7 @@ static ssize_t sequence_store(struct device *dev, struct device_attribute *attr,
param = (struct ec_params_lightbar *)msg->data;
param->cmd = LIGHTBAR_CMD_SEQ;
param->seq.num = num;
- msg->outsize = offsetof(typeof(*param), seq) + sizeof(param->seq);
+ msg->outsize = struct_offset(param, seq) + sizeof(param->seq);
msg->insize = 0;
ret = lb_throttle();
if (ret)
@@ -508,7 +508,7 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,
* Bound the payload strictly by the maximum value the structural
* size field can natively support.
*/
- extra_bytes = offsetof(typeof(*param), set_program_ex) +
+ extra_bytes = struct_offset(param, set_program_ex) +
sizeof(param->set_program_ex);
max_size = min_t(size_t, ec->ec_dev->max_request - extra_bytes,
type_max(typeof(param->set_program_ex.size)));
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 20b1aef455c4f4..159daefd249ed2 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -185,7 +185,7 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
comp_status, ct_rsp->header.response);
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha,
0x2078, ct_rsp,
- offsetof(typeof(*ct_rsp), rsp));
+ struct_offset(ct_rsp, rsp));
rval = QLA_INVALID_COMMAND;
} else
rval = QLA_SUCCESS;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 59ec5605930b7d..251c95d62fd015 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3225,7 +3225,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc;
uint32_t *iter = (uint32_t *)stats;
- ushort dwords = offsetof(typeof(*stats), link_up_cnt)/sizeof(*iter);
+ ushort dwords = struct_offset(stats, link_up_cnt) / sizeof(*iter);
struct qla_hw_data *ha = vha->hw;
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1084,
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3c412c7fb6fe76..8e6a953dc3f762 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -6263,7 +6263,7 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha,
if (qla25xx_rdp_rsp_reduce_size(vha, purex)) {
rsp_payload_length =
- offsetof(typeof(*rsp_payload), optical_elmt_desc);
+ struct_offset(rsp_payload, optical_elmt_desc);
ql_dbg(ql_dbg_init, vha, 0x0181,
"Reducing RSP payload length to %u bytes...\n",
rsp_payload_length);
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index f96b9eb15126b4..814988895620b9 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -7,7 +7,7 @@
#include "qla_tmpl.h"
#define ISPREG(vha) (&(vha)->hw->iobase->isp24)
-#define IOBAR(reg) offsetof(typeof(*(reg)), iobase_addr)
+#define IOBAR(reg) struct_offset(reg, iobase_addr)
#define IOBASE(vha) IOBAR(ISPREG(vha))
#define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL)
@@ -722,7 +722,7 @@ static struct qla27xx_fwdt_entry *
qla27xx_fwdt_entry_t275(struct scsi_qla_host *vha,
struct qla27xx_fwdt_entry *ent, void *buf, ulong *len)
{
- ulong offset = offsetof(typeof(*ent), t275.buffer);
+ ulong offset = struct_offset(ent, t275.buffer);
ulong length = le32_to_cpu(ent->t275.length);
ulong size = le32_to_cpu(ent->hdr.size);
void *buffer = ent->t275.buffer;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index bec6ca38375bd6..09ee87ebd5d1a5 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -570,7 +570,7 @@ fc_host_post_fc_event(struct Scsi_Host *shost, u32 event_number,
event->event_code = event_code;
if (data_len)
memcpy(event->event_data_flex, data_buf, data_len);
- padding = len - offsetof(typeof(*event), event_data_flex) - data_len;
+ padding = len - struct_offset(event, event_data_flex) - data_len;
memset(event->event_data_flex + data_len, 0, padding);
nlmsg_multicast(scsi_nl_sock, skb, 0, SCSI_NL_GRP_FC_EVENTS,
diff --git a/fs/readdir.c b/fs/readdir.c
index f2288841337ad1..858ee501d4f735 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -22,7 +22,7 @@
#include <linux/compat.h>
#include <linux/uaccess.h>
-#define dirent_size(dirent, len) offsetof(typeof(*(dirent)), d_name[len])
+#define dirent_size(dirent, len) struct_offset(dirent, d_name[len])
/*
* Some filesystems were never converted to '->iterate_shared()'
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 68f05a52605f4f..a777c5ee6dc944 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -3200,7 +3200,7 @@ struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data,
io_req->ParameterCount = io_req->TotalParameterCount;
io_req->ParameterOffset = cpu_to_le32(0);
io_req->DataCount = io_req->TotalDataCount;
- io_req->DataOffset = cpu_to_le32(offsetof(typeof(*io_req), Data));
+ io_req->DataOffset = cpu_to_le32(struct_offset(io_req, Data));
io_req->SetupCount = 4;
io_req->SubCommand = cpu_to_le16(NT_TRANSACT_IOCTL);
io_req->FunctionCode = cpu_to_le32(FSCTL_SET_REPARSE_POINT);
@@ -5973,7 +5973,7 @@ int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
param_offset = offsetof(struct smb_com_transaction2_spi_req,
InformationLevel);
offset = param_offset + params;
- data_offset = (char *)pSMB + offsetof(typeof(*pSMB), hdr.Protocol) + offset;
+ data_offset = (char *)pSMB + struct_offset(pSMB, hdr.Protocol) + offset;
pSMB->ParameterOffset = cpu_to_le16(param_offset);
pSMB->DataOffset = cpu_to_le16(offset);
pSMB->SetupCount = 1;
diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
index 3a27773186ae43..ac6db460a942a3 100644
--- a/fs/smb/client/reparse.c
+++ b/fs/smb/client/reparse.c
@@ -1042,7 +1042,8 @@ static int parse_reparse_wsl_symlink(struct reparse_wsl_symlink_data_buffer *buf
struct cifs_open_info_data *data)
{
int len = le16_to_cpu(buf->ReparseDataLength);
- int data_offset = offsetof(typeof(*buf), Target) - offsetof(typeof(*buf), Version);
+ int data_offset = struct_offset(buf, Target) - struct_offset(buf,
+ Version);
int symname_utf8_len;
__le16 *symname_utf16;
int symname_utf16_len;
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index f909e2b25158a8..78e836ef76eeeb 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -306,7 +306,7 @@ xchk_xattr_local_entry(
char *name_end;
unsigned int namesize;
- name_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]);
+ name_end = (char *)lentry + struct_offset(lentry, nameval[0]);
if (name_end > buf_end) {
xchk_da_set_corrupt(ds, level);
return 0;
@@ -341,7 +341,7 @@ xchk_xattr_remote_entry(
char *name_end;
unsigned int namesize;
- name_end = (char *)rentry + offsetof(typeof(*rentry), name[0]);
+ name_end = (char *)rentry + struct_offset(rentry, name[0]);
if (name_end > buf_end) {
xchk_da_set_corrupt(ds, level);
return 0;
diff --git a/fs/xfs/scrub/attr_repair.c b/fs/xfs/scrub/attr_repair.c
index 720090895c20f5..901f9a126e65cb 100644
--- a/fs/xfs/scrub/attr_repair.c
+++ b/fs/xfs/scrub/attr_repair.c
@@ -294,7 +294,7 @@ xrep_xattr_salvage_local_attr(
* Decode the leaf local entry format. If something seems wrong, we
* junk the attribute.
*/
- name_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]);
+ name_end = (char *)lentry + struct_offset(lentry, nameval[0]);
if (name_end > buf_end)
return 0;
value = &lentry->nameval[lentry->namelen];
@@ -348,7 +348,7 @@ xrep_xattr_salvage_remote_attr(
* junk the attribute. Note that we should never find a zero-length
* remote attribute value.
*/
- name_end = (char *)rentry + offsetof(typeof(*rentry), name[0]);
+ name_end = (char *)rentry + struct_offset(rentry, name[0]);
if (name_end > buf_end)
return 0;
namesize = xfs_attr_leaf_entsize_remote(rentry->namelen);
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
index d99e2a73272306..a90dcc92ca9754 100644
--- a/fs/xfs/scrub/dir.c
+++ b/fs/xfs/scrub/dir.c
@@ -364,7 +364,7 @@ xchk_dir_check_entry(
unsigned int advance;
/* must have namelen */
- advance = offsetof(typeof(*dep), name);
+ advance = struct_offset(dep, name);
if (iter_off + advance >= end) {
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
return -1;
@@ -464,7 +464,7 @@ xchk_dir_rec(
int advance;
/* must have freetag */
- advance = offsetof(typeof(*dup), length);
+ advance = struct_offset(dup, length);
if (iter_off + advance >= end) {
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
goto out_relse;
diff --git a/fs/xfs/scrub/dir_repair.c b/fs/xfs/scrub/dir_repair.c
index 518e15d93d3b42..c7d234b592c217 100644
--- a/fs/xfs/scrub/dir_repair.c
+++ b/fs/xfs/scrub/dir_repair.c
@@ -501,7 +501,7 @@ xrep_dir_recover_entry(
int error;
/* must have namelen */
- advance = offsetof(typeof(*dep), name);
+ advance = struct_offset(dep, name);
if (offset + advance >= end)
return 0;
@@ -546,7 +546,7 @@ xrep_dir_recover_data(
return error;
/* must have freetag */
- advance = offsetof(typeof(*dup), length);
+ advance = struct_offset(dup, length);
if (offset + advance >= end)
break;
diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index d0f04436343e5f..c029d68daeca1b 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -464,6 +464,18 @@ static __always_inline size_t __must_check size_sub(size_t minuend, size_t subtr
*/
#define struct_offset(p, member) (offsetof(typeof(*(p)), member))
+/**
+ * struct_offsetofend() - Calculate the end of a member within a struct
+ * @p: Pointer to the struct
+ * @member: Name of the member to get the end offset of
+ *
+ * Calculates the offset of the end of a particular @member of the structure
+ * pointed to by @p.
+ *
+ * Return: number of bytes to the end of @member.
+ */
+#define struct_offsetofend(p, member) (offsetofend(typeof(*(p)), member))
+
/**
* __DEFINE_FLEX() - helper macro for DEFINE_FLEX() family.
* Enables caller macro to pass arbitrary trailing expressions
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index a240638f69e5c6..a7ef407e1e93a3 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -388,7 +388,8 @@ __futex_hash(union futex_key *key, struct futex_private_hash *fph, struct futex_
}
#endif
- hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / sizeof(u32),
+ hash = jhash2((u32 *)key,
+ struct_offset(key, both.offset) / sizeof(u32),
key->both.offset);
if (node == FUTEX_NO_NODE) {
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index d6c9dc62182ee4..519c4de7cfe2b9 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -1613,7 +1613,7 @@ int bpf_prog_test_run_sk_lookup(struct bpf_prog *prog, const union bpf_attr *kat
if (user_ctx->sk)
goto out;
- if (!range_is_zero(user_ctx, offsetofend(typeof(*user_ctx), local_port), sizeof(*user_ctx)))
+ if (!range_is_zero(user_ctx, struct_offsetofend(user_ctx, local_port), sizeof(*user_ctx)))
goto out;
if (user_ctx->local_port > U16_MAX) {
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index d42d776af273e4..0db29c6fd3d3ca 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -451,8 +451,8 @@ EXPORT_SYMBOL(ip_output);
*/
static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4)
{
- BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) !=
- offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr));
+ BUILD_BUG_ON(struct_offset(fl4, daddr) !=
+ struct_offset(fl4, saddr) + sizeof(fl4->saddr));
iph->saddr = fl4->saddr;
iph->daddr = fl4->daddr;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2e5562f353f85d..3dfb60b67fe980 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2526,7 +2526,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = 0;
hslot = udp_hashslot(udptable, net, hnum);
use_hash2 = hslot->count > 10;
- offset = offsetof(typeof(*sk), sk_node);
+ offset = struct_offset(sk, sk_node);
if (use_hash2) {
hash2_any = ipv4_portaddr_hash(net, htonl(INADDR_ANY), hnum) &
@@ -2534,7 +2534,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = ipv4_portaddr_hash(net, daddr, hnum) & udptable->mask;
start_lookup:
hslot = &udptable->hash2[hash2].hslot;
- offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
+ offset = struct_offset(sk, __sk_common.skc_portaddr_node);
}
sk_for_each_entry_offset_rcu(sk, node, &hslot->head, offset) {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 9dcefa16252235..6b396a4eb2b953 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -962,7 +962,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = 0;
hslot = udp_hashslot(udptable, net, hnum);
use_hash2 = hslot->count > 10;
- offset = offsetof(typeof(*sk), sk_node);
+ offset = struct_offset(sk, sk_node);
if (use_hash2) {
hash2_any = ipv6_portaddr_hash(net, &in6addr_any, hnum) &
@@ -970,7 +970,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = ipv6_portaddr_hash(net, daddr, hnum) & udptable->mask;
start_lookup:
hslot = &udptable->hash2[hash2].hslot;
- offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
+ offset = struct_offset(sk, __sk_common.skc_portaddr_node);
}
sk_for_each_entry_offset_rcu(sk, node, &hslot->head, offset) {
diff --git a/net/key/af_key.c b/net/key/af_key.c
index d215b33b7492c2..20016a2770f789 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -384,7 +384,7 @@ static int verify_address_len(const void *p)
int len;
if (sp->sadb_address_len <
- DIV_ROUND_UP(sizeof(*sp) + offsetofend(typeof(*addr), sa_family),
+ DIV_ROUND_UP(sizeof(*sp) + struct_offsetofend(addr, sa_family),
sizeof(uint64_t)))
return -EINVAL;
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 01d6703767c638..72f78c4a58d424 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -493,8 +493,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
ieee80211_retrieve_addba_ext_data(sta,
mgmt->u.action.addba_req.variable,
len -
- offsetof(typeof(*mgmt),
- u.action.addba_req.variable),
+ struct_offset(mgmt, u.action.addba_req.variable),
&buf_size);
__ieee80211_start_rx_ba_session(sta, dialog_token, timeout,
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index f3ecdd8601a042..58a13cddee2e85 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -990,8 +990,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
ieee80211_retrieve_addba_ext_data(sta,
mgmt->u.action.addba_resp.variable,
- len - offsetof(typeof(*mgmt),
- u.action.addba_resp.variable),
+ len - struct_offset(mgmt, u.action.addba_resp.variable),
&buf_size);
buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
diff --git a/net/mac80211/parse.c b/net/mac80211/parse.c
index f3c5a9f6ec7c0e..e5a752e674f795 100644
--- a/net/mac80211/parse.c
+++ b/net/mac80211/parse.c
@@ -1068,7 +1068,7 @@ ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params)
bool inside_multilink = false;
BUILD_BUG_ON(sizeof(empty_non_inheritance) != empty_non_inheritance[1] + 2);
- BUILD_BUG_ON(offsetof(typeof(*elems_parse), elems) != 0);
+ BUILD_BUG_ON(struct_offset(elems_parse, elems) != 0);
/* cannot parse for both a specific link and non-transmitted BSS */
if (WARN_ON(params->link_id >= 0 && params->bss))
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 8ae01c277fd265..eb2c034493c4f6 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -1767,7 +1767,7 @@ ieee80211_process_tdls_channel_switch_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_tdls_data *tf = (void *)skb->data;
bool local_initiator;
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
- int baselen = offsetof(typeof(*tf), u.chan_switch_resp.variable);
+ int baselen = struct_offset(tf, u.chan_switch_resp.variable);
struct ieee80211_tdls_ch_sw_params params = {};
int ret;
@@ -1868,7 +1868,7 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
enum nl80211_band band;
struct ieee80211_tdls_data *tf = (void *)skb->data;
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
- int baselen = offsetof(typeof(*tf), u.chan_switch_req.variable);
+ int baselen = struct_offset(tf, u.chan_switch_req.variable);
struct ieee80211_tdls_ch_sw_params params = {};
int ret = 0;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e7dd32880598fd..9b735caaf2b7e6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -333,7 +333,7 @@ static int validate_beacon_head(const struct nlattr *attr,
unsigned int fixedlen, hdrlen;
bool s1g_bcn;
- if (len < offsetofend(typeof(*mgmt), frame_control))
+ if (len < struct_offsetofend(mgmt, frame_control))
goto err;
s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control);
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5cd3880ee3841d..4fc1bf251c15d8 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -707,7 +707,7 @@ static bool valid_country(const u8 *data, unsigned int size,
unsigned int i;
/* make sure we can read len/n_rules */
- if ((u8 *)coll + offsetofend(typeof(*coll), n_rules) > data + size)
+ if ((u8 *)coll + struct_offsetofend(coll, n_rules) > data + size)
return false;
/* make sure base struct and all rules fit */
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 1c50a16c0e9bea..28a46d49de04f8 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -587,7 +587,7 @@ static int cfg80211_parse_ap_info(struct cfg80211_colocated_ap *entry,
bss_params = tbtt_info->bss_params;
/* Ignore disabled links */
- if (length >= offsetofend(typeof(*tbtt_info), mld_params)) {
+ if (length >= struct_offsetofend(tbtt_info, mld_params)) {
if (le16_get_bits(tbtt_info->mld_params.params,
IEEE80211_RNR_MLD_PARAMS_DISABLED_LINK))
return -EINVAL;
diff --git a/scripts/coccinelle/api/struct_offsetof.cocci b/scripts/coccinelle/api/struct_offsetof.cocci
new file mode 100644
index 00000000000000..5a30647d378720
--- /dev/null
+++ b/scripts/coccinelle/api/struct_offsetof.cocci
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/// Use struct_offset() family of macros
+///
+// Confidence: High
+// Options: --no-includes --ignore ./tools/
+
+virtual patch
+
+@offsetof depends on patch@
+expression ptr, member;
+@@
+- offsetof(typeof(*(ptr)), member)
++ struct_offset(ptr, member)
+@offsetofend depends on patch@
+expression ptr, member;
+@@
+- offsetofend(typeof(*(ptr)), member)
++ struct_offsetofend(ptr, member)
diff --git a/security/landlock/net.c b/security/landlock/net.c
index 8fd73cf4bd15b4..2f4bbd3bfe27c0 100644
--- a/security/landlock/net.c
+++ b/security/landlock/net.c
@@ -93,7 +93,7 @@ static int current_check_access_socket(struct socket *const sock,
return 0;
/* Checks for minimal header length to safely read sa_family. */
- if (addrlen < (int)offsetofend(typeof(*address), sa_family))
+ if (addrlen < (int)struct_offsetofend(address, sa_family))
return -EINVAL;
/*
@@ -382,7 +382,7 @@ static int hook_socket_connect(struct socket *const sock,
* should never be restricted.
*/
if (ret == 0 && sk_is_udp(sock->sk) &&
- addrlen >= offsetofend(typeof(*address), sa_family) &&
+ addrlen >= struct_offsetofend(address, sa_family) &&
address->sa_family != AF_UNSPEC)
ret = current_check_autobind_udp_socket(sock);
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index ed5fe746d43856..6e4f56a06aed6d 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -9656,7 +9656,7 @@ static long scarlett2_hwdep_write(struct snd_hwdep *hw,
/* Calculate the maximum permitted in data[] */
const size_t max_data_size = SCARLETT2_FLASH_RW_MAX -
- offsetof(typeof(*req), data);
+ struct_offset(req, data);
/* If erasing, wait for it to complete */
if (private->flash_write_state ==
|
| 3/2 | 2026/11/22 12:50 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 22658 output: 35 thoughts: 302 Thoughts: **Analyzing the Patch: Offset Macro Introduction** Okay, let's break down this patch. My initial thought is to understand the implications of this new macro, `struct_offsetofend(p, member)`, defined in `include/linux/overflow.h`. My immediate focus is on its intended use and how it relates to the existing macro landscape. The code shows the definition: It seems straightforward; it's designed to calculate the offset of the *end* of a member within a struct, as the comment indicates. This seems like a potentially useful addition. Then there is the comparison with the pre-existing macros. Now, this Coccinelle script, `scripts/coccinelle/api/struct_offsetof.cocci`, it looks like its job is to perform a code cleanup by replacing usages of the base `offsetof` in a very targeted way. Specifically, it's replacing `offsetof(typeof(*(ptr)), member)` with the new `struct_offset(ptr, member)` macro and similarly, `offsetofend(typeof(*(ptr)), member)` with `struct_offsetofend(ptr, member)`. That's a classic refactoring strategy, a move from a more generic construct to a more semantically clear one. Now I need to see what `struct_offset` was actually defined as before this patch. My instinct is that I need to check the pre-patch definition of `struct_offset` to understand the full context. Let me check `include/linux/overflow.h`...Let me grab that file at around line 464... |
| 4/2 | 2026/11/22 12:50 | tool | read-file |
0mArgs:{
"File": "include/linux/overflow.h",
"FirstLine": 455,
"LineCount": 30
}Results: {
"Contents": " 455:\t/**\n 456:\t * struct_offset() - Calculate the offset of a member within a struct\n 457:\t * @p: Pointer to the struct\n 458:\t * @member: Name of the member to get the offset of\n 459:\t *\n 460:\t * Calculates the offset of a particular @member of the structure pointed\n 461:\t * to by @p.\n 462:\t *\n 463:\t * Return: number of bytes to the location of @member.\n 464:\t */\n 465:\t#define struct_offset(p, member) (offsetof(typeof(*(p)), member))\n 466:\t\n 467:\t/**\n 468:\t * struct_offsetofend() - Calculate the end of a member within a struct\n 469:\t * @p: Pointer to the struct\n 470:\t * @member: Name of the member to get the end offset of\n 471:\t *\n 472:\t * Calculates the offset of the end of a particular @member of the structure\n 473:\t * pointed to by @p.\n 474:\t *\n 475:\t * Return: number of bytes to the end of @member.\n 476:\t */\n 477:\t#define struct_offsetofend(p, member) (offsetofend(typeof(*(p)), member))\n 478:\t\n 479:\t/**\n 480:\t * __DEFINE_FLEX() - helper macro for DEFINE_FLEX() family.\n 481:\t * Enables caller macro to pass arbitrary trailing expressions\n 482:\t *\n 483:\t * @type: structure type name, including \"struct\" keyword.\n 484:\t * @name: Name for a variable to define.\n"
} |
| 5/2 | 2026/11/22 12:50 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 23790 output: 19 thoughts: 834 Thoughts: **Analyzing a Macro Change: WorthFuzzing or Not?** Okay, so I'm looking at these macro definitions: `struct_offset(p, member)` defined as `(offsetof(typeof(*(p)), member))`, and `struct_offsetofend(p, member)` defined as `(offsetofend(typeof(*(p)), member))`. Seems straightforward; they're just identity macro transformations, right? But the instructions are clear: *do not* trust claims of "no functional change" without digging deeper. Refactorings can introduce subtle bugs. If the executable code is touched, it must be fuzzed. So, is this a *true* 1:1 macro substitution with identical expansion? I need to be certain. Let's refer to Section 2. It dictates when we can confidently say a change is *not* worth fuzzing. I need to see if this change falls strictly into one of those categories. According to Section 2, changes like documentation, user-space tools, decorative logging, or build system changes that *don't* alter the compiled C logic are safe to ignore. But this change modifies `.c` and `.h` files throughout the kernel. Does that mean it doesn't affect compiled C logic? No! I'm thinking, is the compiled C code 100% byte-for-byte identical after this transformation? The macro expands as `(offsetof(typeof(*(p)), member))`, exactly what `struct_offset(p, member)` does. So, no syntactic or semantic difference… or is there? What about side effects in `p`? With `typeof(*(p))`, the expression is unevaluated. And the same for `offsetofend`. The `typeof` is an unevaluated operand, so there should be no differences. But wait, what is `offsetofend`? I need to check how that is defined to fully understand the implications. |
| 6/2 | 2026/11/22 12:51 | tool | grepper |
0mArgs:{
"Expression": "#define offsetofend"
}Results: {
"Output": "include/linux/stddef.h=10=enum {\n--\ninclude/linux/stddef.h-31- */\ninclude/linux/stddef.h:32:#define offsetofend(TYPE, MEMBER) \\\ninclude/linux/stddef.h-33-\t(offsetof(TYPE, MEMBER)\t+ sizeof_field(TYPE, MEMBER))\n--\ntools/lib/bpf/skel_internal.h=253=static inline int skel_closenz(int fd)\n--\ntools/lib/bpf/skel_internal.h-260-#ifndef offsetofend\ntools/lib/bpf/skel_internal.h:261:#define offsetofend(TYPE, MEMBER) \\\ntools/lib/bpf/skel_internal.h-262-\t(offsetof(TYPE, MEMBER)\t+ sizeof((((TYPE *)0)-\u003eMEMBER)))\n--\ntools/testing/selftests/bpf/bpf_util.h=28=static inline ssize_t sized_strscpy(char *dest, const char *src, size_t count)\n--\ntools/testing/selftests/bpf/bpf_util.h-77-#ifndef offsetofend\ntools/testing/selftests/bpf/bpf_util.h:78:#define offsetofend(TYPE, MEMBER) \\\ntools/testing/selftests/bpf/bpf_util.h-79-\t(offsetof(TYPE, MEMBER)\t+ sizeof_field(TYPE, MEMBER))\n--\ntools/testing/selftests/bpf/progs/bpf_misc.h-209-#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)-\u003eMEMBER))\ntools/testing/selftests/bpf/progs/bpf_misc.h:210:#define offsetofend(TYPE, MEMBER) \\\ntools/testing/selftests/bpf/progs/bpf_misc.h-211-\t(offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))\n--\ntools/testing/selftests/bpf/progs/test_cls_redirect_dynptr.c-27-\ntools/testing/selftests/bpf/progs/test_cls_redirect_dynptr.c:28:#define offsetofend(TYPE, MEMBER) \\\ntools/testing/selftests/bpf/progs/test_cls_redirect_dynptr.c-29-\t(offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)-\u003eMEMBER)))\n--\ntools/testing/selftests/iommu/iommufd_utils.h=53=static unsigned long PAGE_SIZE;\n--\ntools/testing/selftests/iommu/iommufd_utils.h-55-#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)-\u003eMEMBER))\ntools/testing/selftests/iommu/iommufd_utils.h:56:#define offsetofend(TYPE, MEMBER) \\\ntools/testing/selftests/iommu/iommufd_utils.h-57-\t(offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))\n"
} |
| 7/2 | 2026/11/22 12:51 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25825 output: 30 thoughts: 5633 Thoughts: **Analysis of Patch for Fuzzing Eligibility** Okay, so I've got this patch in front of me, and I need to determine if it's "WorthFuzzing" according to the kernel patch fuzzing guidelines. My initial thought process is always methodical. First, I need to understand what the code is doing. I see this patch is about `struct_offset` and `struct_offsetofend` changes. It looks like it's replacing direct uses of `offsetof` with the `struct_offset` macro. This macro calculates the offset of a member within a struct. The key is to understand what code this change touches. The most important instruction is the negative criteria, "Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories". It is critical to recognize what the negative criteria is. My eyes are immediately drawn to the files touched: `kernel/futex/core.c`, `net/bpf/test_run.c`, `net/ipv4/udp.c`, `security/landlock/net.c`, `fs/readdir.c`, and so on. I see that code is getting refactored across various core subsystems (networking, futex, file systems, security, drivers). Now, the instructions are clear: *do not blindly trust refactoring claims*. Any modifications to reachable executable code, especially refactorings, must be fuzzed. My expert opinion is, even a "simple" change has the potential to introduce bugs or subtle semantic shifts. This *isn't* a simple documentation fix. It isn't a build system change. It isn't unreachable hardware. This is refactoring within core subsystems, so this directly contradicts the negative criteria. I must *not* ignore the instructions that state if reachable executable code is modified or refactored, it MUST be fuzzed. Now, I'm thinking about the second point, I must identify specific features to target and provide. I have a list of all modified functions. Now, let's pick up the most important (non-ubiquitous) functions and add them to FocusSymbols list. Let's see... Given that the change affects critical areas like kernel futex, networking, and VFS, the `FocusSymbols` will include functions like `__futex_hash`, `__udp4_lib_mcast_deliver`, `__udp6_lib_mcast_deliver`, `current_check_access_socket`, `bpf_prog_test_run_sk_lookup`, and `dirent_size`. I also need to focus on the key changes in the drivers for wifi, USB, and so on, but I need to make sure I do not pick ubiquitous functions (allocator and deallocators are out of the equation). These entries look very specific and representative of the touched logic. Therefore: 1. `WorthFuzzing`: `true` 2. `FocusSymbols`: `__futex_hash`, `__udp4_lib_mcast_deliver`, `__udp6_lib_mcast_deliver`, `current_check_access_socket`, `bpf_prog_test_run_sk_lookup`, `dirent_size`, `mac80211_hwsim_write_tsf`, `verify_address_len`. |
| 8/2 | 2026/11/22 12:51 | tool | grepper |
0mArgs:{
"Expression": "dirent_size",
"PathPrefixes": [
"fs/readdir.c"
]
}Results: {
"Output": "fs/readdir.c-24-\nfs/readdir.c:25:#define dirent_size(dirent, len) struct_offset(dirent, d_name[len])\nfs/readdir.c-26-\n--\nfs/readdir.c=188=static bool fillonedir(struct dir_context *ctx, const char *name, int namlen,\n--\nfs/readdir.c-207-\tdirent = buf-\u003edirent;\nfs/readdir.c:208:\tscoped_user_write_access_size(dirent, dirent_size(dirent, namlen + 1), efault) {\nfs/readdir.c-209-\t\tunsafe_put_user(d_ino, \u0026dirent-\u003ed_ino, efault);\n--\nfs/readdir.c=261=static bool filldir(struct dir_context *ctx, const char *name, int namlen,\n--\nfs/readdir.c-267-\tunsigned long d_ino;\nfs/readdir.c:268:\tint reclen = ALIGN(dirent_size(dirent, namlen + 2), sizeof(long));\nfs/readdir.c-269-\tint prev_reclen;\n--\nfs/readdir.c=346=static bool filldir64(struct dir_context *ctx, const char *name, int namlen,\n--\nfs/readdir.c-351-\t\tcontainer_of(ctx, struct getdents_callback64, ctx);\nfs/readdir.c:352:\tint reclen = ALIGN(dirent_size(dirent, namlen + 1), sizeof(u64));\nfs/readdir.c-353-\tint prev_reclen;\n--\nfs/readdir.c=434=static bool compat_fillonedir(struct dir_context *ctx, const char *name,\n--\nfs/readdir.c-454-\tdirent = buf-\u003edirent;\nfs/readdir.c:455:\tscoped_user_write_access_size(dirent, dirent_size(dirent, namlen + 1), efault) {\nfs/readdir.c-456-\t\tunsafe_put_user(d_ino, \u0026dirent-\u003ed_ino, efault);\n--\nfs/readdir.c=502=static bool compat_filldir(struct dir_context *ctx, const char *name, int namlen,\n--\nfs/readdir.c-508-\tcompat_ulong_t d_ino;\nfs/readdir.c:509:\tint reclen = ALIGN(dirent_size(dirent, namlen + 2), sizeof(compat_long_t));\nfs/readdir.c-510-\tint prev_reclen;\n"
} |
| 9/2 | 2026/11/22 12:51 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32884 output: 35 thoughts: 483 Thoughts: **Analyzing Potential Hotspots in Directory Reading and Kernel Synchronization** Okay, so I'm thinking about performance and potential bottlenecks, and I'm focusing on areas that are frequently accessed. I see that the `filldir` functions (`filldir`, `filldir64`, etc.) in `fs/readdir.c` are called for directory reading, which is, of course, everywhere. This is something I'd want to keep in mind, because directories are a fundamental part of the filesystem. Then my mind jumps to `futex_hash`. FUTEX is a core synchronization primitive – it's used *everywhere*. Its lifecycle touches things like memory allocation and deallocation, handling page faults and traps, and general synchronization. Thus I need to avoid `__futex_hash` or `futex` generic symbols if at all possible because these are bound to be called all over the place. Let's look at some other candidates. I'll need to check the following to build a fuller picture: * `bpf_prog_test_run_sk_lookup` in `net/bpf/test_run.c` * `verify_address_len` in `net/key/af_key.c` * `current_check_access_socket` in `security/landlock/net.c` * `mac80211_hwsim_write_tsf` in `drivers/net/wireless/virtual/mac80211_hwsim_main.c` * `__udp4_lib_mcast_deliver` in `net/ipv4/udp.c` * `__udp6_lib_mcast_deliver` in `net/ipv6/udp.c` * `ieee80211_process_addba_request` and `ieee80211_process_addba_resp` in `net/mac80211` * `xchk_xattr_local_entry` and `xchk_dir_check_entry` in `fs/xfs/scrub` * `uvc_v4l2_put_xu_mapping` and `uvc_v4l2_put_xu_query` in `drivers/media/usb/uvc/uvc_v4l2.c` I need to confirm if `verify_address_len` is indeed in `net/key/af_key.c` and then I'll use grep or check the file to see which call sites exist for `verify_address_len`. That should give me a good handle on where these functions are getting called and how often. |
| 10/2 | 2026/11/22 12:52 | tool | grepper |
0mArgs:{
"Expression": "verify_address_len",
"PathPrefixes": [
"net/key/af_key.c"
]
}Results: {
"Output": "net/key/af_key.c=345=static const u8 sadb_ext_min_len[] = {\n--\nnet/key/af_key.c-375-/* Verify sadb_address_{len,prefixlen} against sa_family. */\nnet/key/af_key.c:376:static int verify_address_len(const void *p)\nnet/key/af_key.c-377-{\n--\nnet/key/af_key.c=507=static int parse_exthdrs(struct sk_buff *skb, const struct sadb_msg *hdr, void **ext_hdrs)\n--\nnet/key/af_key.c-540-\t\t\tcase SADB_X_EXT_NAT_T_OA:\nnet/key/af_key.c:541:\t\t\t\tif (verify_address_len(p))\nnet/key/af_key.c-542-\t\t\t\t\treturn -EINVAL;\n"
} |
| 11/2 | 2026/11/22 12:52 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 34241 output: 37 thoughts: 80 Thoughts: Here's my take on the thought process: **Diving into `verify_address_len`** Okay, so `verify_address_len` is a static function, nestled away in `net/key/af_key.c`. Right, let me jog my memory... where's this thing getting called? Ah, right! `parse_exthdrs` then, it seems, `pfkey_sendmsg`. Hmm. A little chain of responsibility there. But wait a second... could `verify_address_len` be a good candidate for inlining? It's relatively small, and we're looking at performance in this area. It might be worth a look. Let's dig in and have a closer look at `verify_address_len` itself. Let's see what's actually going on in `net/key/af_key.c`. See if it's got enough going on to make the inline worthwhile. |
| 12/2 | 2026/11/22 12:52 | tool | read-file |
0mArgs:{
"File": "net/key/af_key.c",
"FirstLine": 375,
"LineCount": 30
}Results: {
"Contents": " 375:\t/* Verify sadb_address_{len,prefixlen} against sa_family. */\n 376:\tstatic int verify_address_len(const void *p)\n 377:\t{\n 378:\t\tconst struct sadb_address *sp = p;\n 379:\t\tconst struct sockaddr *addr = (const struct sockaddr *)(sp + 1);\n 380:\t\tconst struct sockaddr_in *sin;\n 381:\t#if IS_ENABLED(CONFIG_IPV6)\n 382:\t\tconst struct sockaddr_in6 *sin6;\n 383:\t#endif\n 384:\t\tint len;\n 385:\t\n 386:\t\tif (sp-\u003esadb_address_len \u003c\n 387:\t\t DIV_ROUND_UP(sizeof(*sp) + struct_offsetofend(addr, sa_family),\n 388:\t\t\t\t sizeof(uint64_t)))\n 389:\t\t\treturn -EINVAL;\n 390:\t\n 391:\t\tswitch (addr-\u003esa_family) {\n 392:\t\tcase AF_INET:\n 393:\t\t\tlen = DIV_ROUND_UP(sizeof(*sp) + sizeof(*sin), sizeof(uint64_t));\n 394:\t\t\tif (sp-\u003esadb_address_len != len ||\n 395:\t\t\t sp-\u003esadb_address_prefixlen \u003e 32)\n 396:\t\t\t\treturn -EINVAL;\n 397:\t\t\tbreak;\n 398:\t#if IS_ENABLED(CONFIG_IPV6)\n 399:\t\tcase AF_INET6:\n 400:\t\t\tlen = DIV_ROUND_UP(sizeof(*sp) + sizeof(*sin6), sizeof(uint64_t));\n 401:\t\t\tif (sp-\u003esadb_address_len != len ||\n 402:\t\t\t sp-\u003esadb_address_prefixlen \u003e 128)\n 403:\t\t\t\treturn -EINVAL;\n 404:\t\t\tbreak;\n"
} |
| 13/2 | 2026/11/22 12:52 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 35081 output: 43 thoughts: 57 Thoughts: Here's my summary, as if I were thinking it: **Investigating `bpf_prog_test_run_sk_lookup` in the BPF Subsystem** Alright, let's dive in and see what's going on with this `net/bpf/test_run.c` file. Hmm, `bpf_prog_test_run_sk_lookup`... interesting. It's *not* static, meaning it's exported and visible outside of its immediate file. That raises a flag; it's designed to be used elsewhere. Right, let's take a look at the code and see exactly what's going on. I need to understand its purpose and how it's intended to be utilized. I'll need to check the calling conventions, the arguments it takes, and what it does internally to get a full picture of its role in the BPF ecosystem. Time to get my hands dirty. |
| 14/2 | 2026/11/22 12:52 | tool | grepper |
0mArgs:{
"Expression": "bpf_prog_test_run_sk_lookup",
"PathPrefixes": [
"net/bpf/test_run.c"
]
}Results: {
"Output": "net/bpf/test_run.c=1516=int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,\n--\nnet/bpf/test_run.c-1584-\nnet/bpf/test_run.c:1585:int bpf_prog_test_run_sk_lookup(struct bpf_prog *prog, const union bpf_attr *kattr,\nnet/bpf/test_run.c-1586-\t\t\t\tunion bpf_attr __user *uattr)\n"
} |
| 15/2 | 2026/11/22 12:52 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 35531 output: 33 thoughts: 101 Thoughts: **Analyzing `bpf_prog_test_run_sk_lookup` and Landlock's Network Security** Okay, so I'm looking at `bpf_prog_test_run_sk_lookup`. First, it's an `int` function, not static, and it's called from `bpf_prog_test_run`, which is important context. The key part I'm focused on is that `if` statement within it: `if (!range_is_zero(user_ctx, struct_offsetofend(user_ctx, local_port), sizeof(*user_ctx)))`. That's the core of what this function is doing at a low level, which I'll be sure to remember. Now, I want to pivot and explore the network security aspects. My next step is to examine the `security/landlock/net.c` file. I need to get a clear picture of the landscape there: What functions are defined? Understanding the available tools and primitives is essential to assess how they interact with this specific BPF context. I need a clear understanding of the network functions within Landlock. |
| 16/2 | 2026/11/22 12:52 | tool | grepper |
0mArgs:{
"Expression": "struct_offsetofend",
"PathPrefixes": [
"security/landlock/net.c"
]
}Results: {
"Output": "security/landlock/net.c=73=static int current_check_access_socket(struct socket *const sock,\n--\nsecurity/landlock/net.c-95-\t/* Checks for minimal header length to safely read sa_family. */\nsecurity/landlock/net.c:96:\tif (addrlen \u003c (int)struct_offsetofend(address, sa_family))\nsecurity/landlock/net.c-97-\t\treturn -EINVAL;\n--\nsecurity/landlock/net.c=363=static int hook_socket_connect(struct socket *const sock,\n--\nsecurity/landlock/net.c-384-\tif (ret == 0 \u0026\u0026 sk_is_udp(sock-\u003esk) \u0026\u0026\nsecurity/landlock/net.c:385:\t addrlen \u003e= struct_offsetofend(address, sa_family) \u0026\u0026\nsecurity/landlock/net.c-386-\t address-\u003esa_family != AF_UNSPEC)\n"
} |
| 17/2 | 2026/11/22 12:52 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36152 output: 59 thoughts: 128 Thoughts: Okay, let's dive into this. Here's how I'm thinking through this code review: **Digging into Potential Network Vulnerabilities within Landlock and mac80211** Right, so I'm starting by looking into potential security holes related to networking, and the Landlock subsystem seems like a good place to start. First, I need to check `security/landlock/net.c`. I'm focusing on the `current_check_access_socket` function. It's static, which is good, meaning its scope is limited within that file. I want to see *how* this function is used, so I'll check its call sites: `hook_socket_bind` and `hook_socket_connect`. I'll need to understand what's happening during those network socket operations. Next, I need to shift gears and look into the mac80211 wireless networking subsystem. I'm going to investigate functions involved in the management of Block Acknowledgement (BA) frames. The functions of interest are `ieee80211_process_addba_request` and `ieee80211_process_addba_resp`. A quick scan should tell me if they are static or not. If not, and they are exported, that's something to investigate further. If they are non-static, I should check the files where these functions are defined: `net/mac80211/agg-rx.c` and `agg-tx.c` to understand their context and interactions. This could be an area where malicious actors might try to exploit BA to gain access. |
| 18/2 | 2026/11/22 12:53 | tool | grepper |
0mArgs:{
"Expression": "ieee80211_process_addba_request|ieee80211_process_addba_resp",
"PathPrefixes": [
"net/mac80211/"
]
}Results: {
"Output": "net/mac80211/agg-rx.c=276=void __ieee80211_start_rx_ba_session(struct sta_info *sta,\n--\nnet/mac80211/agg-rx.c-471-\nnet/mac80211/agg-rx.c:472:void ieee80211_process_addba_request(struct ieee80211_local *local,\nnet/mac80211/agg-rx.c-473-\t\t\t\t struct sta_info *sta,\n--\nnet/mac80211/agg-tx.c=971=EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe);\n--\nnet/mac80211/agg-tx.c-973-\nnet/mac80211/agg-tx.c:974:void ieee80211_process_addba_resp(struct ieee80211_local *local,\nnet/mac80211/agg-tx.c-975-\t\t\t\t struct sta_info *sta,\n--\nnet/mac80211/ieee80211_i.h=2333=void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/ieee80211_i.h-2335-\t\t\t struct ieee80211_mgmt *mgmt, size_t len);\nnet/mac80211/ieee80211_i.h:2336:void ieee80211_process_addba_resp(struct ieee80211_local *local,\nnet/mac80211/ieee80211_i.h-2337-\t\t\t\t struct sta_info *sta,\n--\nnet/mac80211/ieee80211_i.h-2339-\t\t\t\t size_t len);\nnet/mac80211/ieee80211_i.h:2340:void ieee80211_process_addba_request(struct ieee80211_local *local,\nnet/mac80211/ieee80211_i.h-2341-\t\t\t\t struct sta_info *sta,\n--\nnet/mac80211/iface.c=1665=static void ieee80211_iface_process_skb(struct ieee80211_local *local,\n--\nnet/mac80211/iface.c-1682-\t\t\tcase WLAN_ACTION_NDP_ADDBA_REQ:\nnet/mac80211/iface.c:1683:\t\t\t\tieee80211_process_addba_request(local, sta,\nnet/mac80211/iface.c-1684-\t\t\t\t\t\t\t\tmgmt, len);\n--\nnet/mac80211/iface.c-1687-\t\t\tcase WLAN_ACTION_NDP_ADDBA_RESP:\nnet/mac80211/iface.c:1688:\t\t\t\tieee80211_process_addba_resp(local, sta,\nnet/mac80211/iface.c-1689-\t\t\t\t\t\t\t mgmt, len);\n"
} |
| 19/2 | 2026/11/22 12:53 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37582 output: 48 thoughts: 99 Thoughts: Okay, here's my take on those functions. **Examining MAC80211 Function Visibility** Alright, let's see. I'm taking a look at `ieee80211_process_addba_request` and `ieee80211_process_addba_resp`, and I recall they are global functions within mac80211. Now, I want to compare those with `ieee80211_process_tdls_channel_switch_req` and `ieee80211_process_tdls_channel_switch_resp`. It's crucial for me to check whether these latter functions are declared as `static`. I need to ensure the correct access visibility, and specifically whether they're accessible outside of the specific compilation unit. Knowing their scope is vital for code maintainability, and for understanding how the TDLS channel switching functionality interacts with other parts of the driver. If they're static, it implies a more localized scope, which could indicate a design decision to limit their interaction points. That's what I need to dig into. |
| 20/2 | 2026/11/22 12:53 | tool | grepper |
0mArgs:{
"Expression": "ieee80211_process_tdls_channel_switch_req",
"PathPrefixes": [
"net/mac80211/"
]
}Results: {
"Output": "net/mac80211/tdls.c=1855=static int\nnet/mac80211/tdls.c:1856:ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,\nnet/mac80211/tdls.c-1857-\t\t\t\t\t struct sk_buff *skb)\n--\nnet/mac80211/tdls.c=2021=ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata,\n--\nnet/mac80211/tdls.c-2042-\tcase WLAN_TDLS_CHANNEL_SWITCH_REQUEST:\nnet/mac80211/tdls.c:2043:\t\tieee80211_process_tdls_channel_switch_req(sdata, skb);\nnet/mac80211/tdls.c-2044-\t\tbreak;\n"
} |
| 21/2 | 2026/11/22 12:53 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38252 output: 37 thoughts: 79 Thoughts: Here's my thought process, as requested: **Deconstructing a TDLS Channel Switch Function** Okay, so I'm looking at `ieee80211_process_tdls_channel_switch`. Right off the bat, I know this is either being called directly by `ieee80211_process_tdls_action`, or is itself a primary caller. That’s the first thing to establish. Let's see... the code's going to tell us who is calling this particular function. Now, where are we with this? I need to see how the system is managing channel switches, so the next logical step for me is to investigate `net/wireless/scan.c`. It's the right place to look. Now, I'm thinking about how the system uses the parsed AP information, so the next bit of code I want to look at is `cfg80211_parse_ap_info`. It’s probably being used as a part of the channel switch. Now, a key consideration for me is if that's a static function. That will limit its scope, and potentially change my understanding of its role in the process. Okay, let's trace this function and understand its relationship within the overall system. Time to check the function's callers to determine how this plays out in practice. |
| 22/2 | 2026/11/22 12:53 | tool | grepper |
0mArgs:{
"Expression": "cfg80211_parse_ap_info",
"PathPrefixes": [
"net/wireless/"
]
}Results: {
"Output": "net/wireless/scan.c=568=EXPORT_SYMBOL_IF_CFG80211_KUNIT(cfg80211_free_coloc_ap_list);\nnet/wireless/scan.c-569-\nnet/wireless/scan.c:570:static int cfg80211_parse_ap_info(struct cfg80211_colocated_ap *entry,\nnet/wireless/scan.c-571-\t\t\t\t const u8 *pos, u8 length,\n--\nnet/wireless/scan.c=709=cfg80211_parse_colocated_ap_iter(void *_data, u8 type,\n--\nnet/wireless/scan.c-741-\nnet/wireless/scan.c:742:\tif (!cfg80211_parse_ap_info(entry, tbtt_info, tbtt_info_len,\nnet/wireless/scan.c-743-\t\t\t\t data-\u003essid_elem, data-\u003es_ssid_tmp)) {\n"
} |
| 23/2 | 2026/11/22 12:53 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 38925 output: 38 thoughts: 31 Thoughts: Here's my thought process, as if I were analyzing that code: **Diving into the 802.11 Beacon Validation** Alright, time to dig into this beacon validation. My initial thought is to zero in on `net/wireless/nl80211.c`. That seems like the right place for core 802.11-related stuff, especially when dealing with the netlink interface. I need to understand exactly *how* and *where* beacon headers are being checked, so let's start with a function name like `validate_beacon_head`. The first thing I’ll want to do is see where this function is used. Determining the call chain is the logical next step. I'm going to look for all the callers of this function. I need to know the context of its use, and what parts of the system are relying on it. That will immediately give me clues about its purpose and potential areas of concern. Finding its call sites will allow me to immediately build a picture of where in the system beacon validation takes place, and what triggers this check. |
| 24/2 | 2026/11/22 12:53 | tool | grepper |
0mArgs:{
"Expression": "validate_beacon_head",
"PathPrefixes": [
"net/wireless/nl80211.c"
]
}Results: {
"Output": "net/wireless/nl80211.c=309=nl80211_lock_held_wdev(struct cfg80211_registered_device *rdev,\n--\nnet/wireless/nl80211.c-324-\nnet/wireless/nl80211.c:325:static int validate_beacon_head(const struct nlattr *attr,\nnet/wireless/nl80211.c-326-\t\t\t\tstruct netlink_ext_ack *extack)\n--\nnet/wireless/nl80211.c=745=nl80211_s1g_short_beacon[NL80211_S1G_SHORT_BEACON_ATTR_MAX + 1] = {\nnet/wireless/nl80211.c-746-\t[NL80211_S1G_SHORT_BEACON_ATTR_HEAD] =\nnet/wireless/nl80211.c:747:\t\tNLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_beacon_head,\nnet/wireless/nl80211.c-748-\t\t\t\t IEEE80211_MAX_DATA_LEN),\n--\nnet/wireless/nl80211.c=801=static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {\n--\nnet/wireless/nl80211.c-848-\t[NL80211_ATTR_BEACON_HEAD] =\nnet/wireless/nl80211.c:849:\t\tNLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_beacon_head,\nnet/wireless/nl80211.c-850-\t\t\t\t IEEE80211_MAX_DATA_LEN),\n"
} |
| 25/2 | 2026/11/22 12:53 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 39702 output: 43 thoughts: 70 Thoughts: Here's my summary, as if I were thinking it: **Digging into the Beacon Head Validation** Okay, so I'm seeing `validate_beacon_head` here. Right, that's the policy validation function that the netlink parsing in `nl80211` calls. Makes sense, that's where you'd expect to find it. Let's trace it through. Hmm, where's the actual implementation happening? I need to check how it works with the hwsim module. Okay, let me find `mac80211_hwsim_write_tsf`... looks like it is located in `drivers/net/wireless/virtual/mac80211_hwsim_main.c`. That's the right place to start digging to see the full picture. Let's see how this ties into the validation logic. |
| 26/2 | 2026/11/22 12:53 | tool | grepper |
0mArgs:{
"Expression": "mac80211_hwsim_write_tsf",
"PathPrefixes": [
"drivers/net/wireless/virtual/"
]
}Results: {
"Output": "drivers/net/wireless/virtual/mac80211_hwsim_main.c=1579=static inline u16 trans_tx_rate_flags_ieee2hwsim(struct ieee80211_tx_rate *rate)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1608-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1609:static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1610-\t\t\t\t struct sk_buff *skb, u64 sim_time)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1650=static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1678-\tsim_tsf = mac80211_hwsim_get_sim_tsf();\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1679:\tmac80211_hwsim_write_tsf(data, my_skb, sim_tsf);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1680-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1908=static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1918-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1919:\tmac80211_hwsim_write_tsf(data, skb, sim_tsf);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1920-\n"
} |
| 27/2 | 2026/11/22 12:53 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 40586 output: 57 thoughts: 160 Thoughts: **Delving into UDP and UVC Kernel Modules** Okay, so I'm thinking about where to look for relevant code, and my mind immediately jumps to the UDP implementations. Specifically, `net/ipv4/udp.c` and `net/ipv6/udp.c` – that's the obvious starting point. I recall those `__udp4_lib_mcast_deliver` and `__udp6_lib_mcast_deliver` functions for multicast handling. That's a good lead. I need to confirm if `__udp4_lib_mcast_deliver` is actually *called* during the UDP multicast packet delivery process. Aha, yes, multicast packet delivery - that's definitely a distinct area. It's not as broadly applicable as typical unicast UDP `recvmsg` but focuses on multicast scenarios. Now, let's switch gears. What about `drivers/media/usb/uvc/uvc_v4l2.c`? My expertise tells me to explore that UVC driver. I'm immediately interested in `uvc_v4l2_put_xu_mapping` and `uvc_v4l2_put_xu_query`. I should definitely examine the callers of those two functions. |
| 28/2 | 2026/11/22 12:53 | tool | grepper |
0mArgs:{
"Expression": "uvc_v4l2_put_xu_mapping|uvc_v4l2_put_xu_query",
"PathPrefixes": [
"drivers/media/usb/uvc/"
]
}Results: {
"Output": "drivers/media/usb/uvc/uvc_v4l2.c=1089=static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,\n--\ndrivers/media/usb/uvc/uvc_v4l2.c-1107-\ndrivers/media/usb/uvc/uvc_v4l2.c:1108:static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,\ndrivers/media/usb/uvc/uvc_v4l2.c-1109-\t\t\tstruct uvc_xu_control_mapping32 __user *up)\n--\ndrivers/media/usb/uvc/uvc_v4l2.c=1129=static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,\n--\ndrivers/media/usb/uvc/uvc_v4l2.c-1146-\ndrivers/media/usb/uvc/uvc_v4l2.c:1147:static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,\ndrivers/media/usb/uvc/uvc_v4l2.c-1148-\t\t\tstruct uvc_xu_control_query32 __user *up)\n--\ndrivers/media/usb/uvc/uvc_v4l2.c=1158=static long uvc_v4l2_compat_ioctl32(struct file *file,\n--\ndrivers/media/usb/uvc/uvc_v4l2.c-1182-\t\t\tbreak;\ndrivers/media/usb/uvc/uvc_v4l2.c:1183:\t\tret = uvc_v4l2_put_xu_mapping(\u0026karg.xmap, up);\ndrivers/media/usb/uvc/uvc_v4l2.c-1184-\t\tif (ret)\n--\ndrivers/media/usb/uvc/uvc_v4l2.c-1194-\t\t\tbreak;\ndrivers/media/usb/uvc/uvc_v4l2.c:1195:\t\tret = uvc_v4l2_put_xu_query(\u0026karg.xqry, up);\ndrivers/media/usb/uvc/uvc_v4l2.c-1196-\t\tif (ret)\n"
} |
| 29/2 | 2026/11/22 12:53 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 41706 output: 29 thoughts: 514 Thoughts: **My Current Kernel Exploration** Okay, so I'm looking at some kernel code, specifically around different areas. First, I noticed that `uvc_v4l2_compat_ioctl32` calls these two functions `uvc_v4l2_put_xu_mapping` and `uvc_v4l2_put_xu_query`. I'll keep that in mind. Now I'm diving into the XFS filesystem scrubbing code. I see quite a few functions that could be relevant, for checking and repairing attributes and directories, such as `xchk_xattr_local_entry`, `xchk_xattr_remote_entry`, `xrep_xattr_salvage_local_attr`, `xchk_dir_check_entry`, `xchk_dir_rec`, `xrep_dir_recover_entry`, and `xrep_dir_recover_data`. I'll want to keep these in my mental model when I'm assessing the XFS scrub and repair functionalities. Next, I'm pivoting to `sound/usb/mixer_scarlett2.c`, specifically `scarlett2_hwdep_write`. This might be interesting, I'll need to remember this for the USB audio work. Now, I'm thinking about the CONFIG options these pieces depend on. Let's see... I've got to check several areas. Starting with `net/bpf/test_run.c`, that looks like it depends on `CONFIG_BPF_SYSCALL` and also `CONFIG_NET`. `security/landlock/net.c` requires `CONFIG_SECURITY_LANDLOCK` and `CONFIG_NET`. Then the `net/mac80211/...` area needs `CONFIG_MAC80211`, `net/wireless/...` relies on `CONFIG_CFG80211`, and `drivers/net/wireless/virtual/mac80211_hwsim_main.c` requires `CONFIG_MAC80211_HWSIM`. I'm seeing a pattern here of networking components, or at least dependencies on some basic networking support. `net/key/af_key.c` needs `CONFIG_NET_KEY`. For the XFS scrubbing code I was looking at earlier, that requires `CONFIG_XFS_ONLINE_SCRUB` and `CONFIG_XFS_ONLINE_REPAIR`. Finally, `drivers/media/usb/uvc/` needs `CONFIG_USB_VIDEO_CLASS`, which makes sense. I will now check Kconfig dependencies in `net/key/Kconfig`. |
| 30/2 | 2026/11/22 12:54 | tool | grepper |
0mArgs:{
"Expression": "config NET_KEY",
"PathPrefixes": [
"net/key/"
]
}Results: {
"Output": "no matches"
} |
| 31/2 | 2026/11/22 12:54 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 42831 output: 20 thoughts: 14 Thoughts: Okay, here's my summary, presented as a stream of thought: **Finding the NET_KEY Definition in Kconfig** Alright, let's get down to brass tacks. I need to figure out where `NET_KEY` is defined within the Kconfig system. This isn't exactly rocket science, but I need to do this efficiently. The goal here is to understand the context and implications of this particular configuration option. I need to track down its dependencies, its default value, and any associated help text. Knowing this information will, of course, guide my understanding of the larger design. Time to dig in! |
| 32/2 | 2026/11/22 12:54 | tool | grepper |
0mArgs:{
"Expression": "config NET_KEY\\b"
}Results: {
"Output": "net/xfrm/Kconfig=106=config XFRM_IPCOMP\n--\nnet/xfrm/Kconfig-111-\nnet/xfrm/Kconfig:112:config NET_KEY\nnet/xfrm/Kconfig-113-\ttristate \"PF_KEY sockets (deprecated)\"\n"
} |
| 33/2 | 2026/11/22 12:54 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 43085 output: 35 thoughts: 20 Thoughts: Here's my take on those thoughts: **Analyzing the XFRM Configuration** Okay, let's dive in. My immediate thought is to zero in on the `net/xfrm/Kconfig` file. I'm focusing specifically around line 112. This likely contains key configuration options related to XFRM – the IPsec framework within the Linux kernel. I'm guessing that line or the lines surrounding it will define a core feature, a crucial module, or possibly a default setting I need to understand better. I need to quickly identify the feature at hand. I should get a more detailed look to see if this is an implementation detail or high-level architecture. Based on the context, I'll assess whether this area requires further investigation based on my existing knowledge or research. |
| 34/2 | 2026/11/22 12:54 | tool | read-file |
0mArgs:{
"File": "net/xfrm/Kconfig",
"FirstLine": 110,
"LineCount": 20
}Results: {
"Contents": " 110:\t\tselect CRYPTO_DEFLATE\n 111:\t\n 112:\tconfig NET_KEY\n 113:\t\ttristate \"PF_KEY sockets (deprecated)\"\n 114:\t\tselect XFRM_ALGO\n 115:\t\thelp\n 116:\t\t PF_KEYv2 socket family, compatible to KAME ones.\n 117:\t\n 118:\t\t The PF_KEYv2 socket interface is deprecated and\n 119:\t\t scheduled for removal. All maintained IKE daemons\n 120:\t\t no longer need PF_KEY sockets. Please use the netlink\n 121:\t\t interface (XFRM_USER) to configure IPsec.\n 122:\t\n 123:\t\t If unsure, say N.\n 124:\t\n 125:\tconfig NET_KEY_MIGRATE\n 126:\t\tbool \"PF_KEY MIGRATE\"\n 127:\t\tdepends on NET_KEY\n 128:\t\tselect XFRM_MIGRATE\n 129:\t\thelp\n"
} |
| 35/2 | 2026/11/22 12:54 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 43593 output: 19 thoughts: 13 Thoughts: Here's my take on those thoughts, tailored for an expert audience: **Examining the Landlock Kconfig for Kernel Configuration** Okay, so the first thing on my mind is diving into the `security/landlock/Kconfig` file. I'm immediately thinking, "Let's see what the latest state of the Landlock configuration options looks like." I want to get a sense of how the feature is being exposed, what knobs are available to users and, critically, how those options interact with the overall kernel build process. I need to understand any dependencies, default settings, and potential conflicts. I'm looking for the core controls that enable or disable Landlock itself, perhaps granularity controls for its features. I'm also anticipating checking for any conditional compilation based on architecture or kernel version. My immediate goal is to establish the current configuration landscape, and identify the key parameters that I'll need to consider in relation to my project. Essentially, I'm forming a mental map of Landlock's configurability. |
| 36/2 | 2026/11/22 12:54 | tool | grepper |
0mArgs:{
"Expression": "config SECURITY_LANDLOCK"
}Results: {
"Output": "security/landlock/Kconfig-2-\nsecurity/landlock/Kconfig:3:config SECURITY_LANDLOCK\nsecurity/landlock/Kconfig-4-\tbool \"Landlock support\"\n--\nsecurity/landlock/Kconfig-23-\nsecurity/landlock/Kconfig:24:config SECURITY_LANDLOCK_LOG\nsecurity/landlock/Kconfig-25-\tbool\n--\nsecurity/landlock/Kconfig-28-\nsecurity/landlock/Kconfig:29:config SECURITY_LANDLOCK_KUNIT_TEST\nsecurity/landlock/Kconfig-30-\tbool \"KUnit tests for Landlock\" if !KUNIT_ALL_TESTS\n"
} |
| 37/2 | 2026/11/22 12:54 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 44009 output: 33 thoughts: 21 Thoughts: Here's a summary of my thought process, as requested: **Diving into the Landlock Configuration** Okay, time to get my hands dirty. I need to understand the configuration options for the Landlock security module, so let's start by looking at its Kconfig file. Specifically, I'm heading straight to the beginning – lines 1 to 20 of `security/landlock/Kconfig`. This usually provides the high-level introduction, module description, and potentially the core feature flags. I expect to find the basic enabling options here: whether the module is compiled in, built as a module, or disabled entirely. I'm also anticipating some critical dependencies or prerequisites that I need to be aware of. Perhaps there are architectural dependencies, or requirements on the kernel version. Hopefully, it's well-documented, too, giving me a solid foundation for understanding the rest of the configuration. Let's see what gems are hidden there! |
| 38/2 | 2026/11/22 12:55 | tool | read-file |
0mArgs:{
"File": "security/landlock/Kconfig",
"FirstLine": 1,
"LineCount": 20
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0-only\n 2:\t\n 3:\tconfig SECURITY_LANDLOCK\n 4:\t\tbool \"Landlock support\"\n 5:\t\tdepends on SECURITY\n 6:\t\tselect SECURITY_NETWORK\n 7:\t\tselect SECURITY_PATH\n 8:\t\thelp\n 9:\t\t Landlock is a sandboxing mechanism that enables processes to restrict\n 10:\t\t themselves (and their future children) by gradually enforcing\n 11:\t\t tailored access control policies. A Landlock security policy is a\n 12:\t\t set of access rights (e.g. open a file in read-only, make a\n 13:\t\t directory, etc.) tied to a file hierarchy. Such policy can be\n 14:\t\t configured and enforced by any processes for themselves using the\n 15:\t\t dedicated system calls: landlock_create_ruleset(),\n 16:\t\t landlock_add_rule(), and landlock_restrict_self().\n 17:\t\n 18:\t\t See Documentation/userspace-api/landlock.rst for further information.\n 19:\t\n 20:\t\t If you are unsure how to answer this question, answer N. Otherwise,\n"
} |
| 39/2 | 2026/11/22 12:55 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 44573 output: 19 thoughts: 34 Thoughts: Okay, let's dive in. **Investigating the Build Configuration for `net/bpf/test_run.c`** Alright, my immediate thought is to zero in on the build configuration for `net/bpf/test_run.c`. I need to figure out which Kconfig options, or combination of options, are required to get this file compiled into the kernel. What dependencies are at play here? Is it a straightforward `CONFIG_THIS` or is it a more complex interplay of multiple options and dependencies? Perhaps there is a specific feature flag, like an extended BPF feature, or maybe some general testing-related flag that pulls it in. I need to understand the underlying build system mechanics to see what's controlling the inclusion of this particular test file. Time to dig in and unravel the build system's secrets. |
| 40/2 | 2026/11/22 12:55 | tool | grepper |
0mArgs:{
"Expression": "test_run\\.o"
}Results: {
"Output": "net/bpf/Makefile-1-# SPDX-License-Identifier: GPL-2.0-only\nnet/bpf/Makefile:2:obj-$(CONFIG_BPF_SYSCALL)\t:= test_run.o\nnet/bpf/Makefile-3-ifeq ($(CONFIG_BPF_JIT),y)\n"
} |
| 41/2 | 2026/11/22 12:55 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 44889 output: 38 thoughts: 124 Thoughts: **My Analysis of BPF, Networking, and Wireless Driver Dependencies** Okay, so I see that enabling `CONFIG_BPF_SYSCALL` automatically includes `net/bpf/test_run.o`. That's expected, given that it's a core BPF testing component. Also, it's clear that `bpf_prog_test_run_sk_lookup` is conditionally compiled based on `CONFIG_BPF_SYSCALL` and `CONFIG_NET`. Naturally, `CONFIG_NET` is typically enabled by default, so it's probably always going to be part of the build when `CONFIG_BPF_SYSCALL` is active. Now, let's switch gears a bit. I need to understand the dependencies of other modules. Let's see... what about `mac80211_hwsim_main.c`? Ah, right, that's controlled by `CONFIG_MAC80211_HWSIM`. I'll have to delve deeper into the dependencies of that particular configuration. My next step is to examine the `drivers/net/wireless/virtual/Makefile` or the `Kconfig` files within that directory. This should provide the information I need to understand how the virtual wireless driver integrates with the broader networking and BPF infrastructure. This will allow me to build a more comprehensive model of the interdependencies. |
| 42/2 | 2026/11/22 12:55 | tool | grepper |
0mArgs:{
"Expression": "mac80211_hwsim",
"PathPrefixes": [
"drivers/net/wireless/virtual/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 1619 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (7 files in total):\ndrivers/net/wireless/virtual/Kconfig:2\ndrivers/net/wireless/virtual/Makefile:3\ndrivers/net/wireless/virtual/mac80211_hwsim.h:4\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:12\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:350\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.c:75\ndrivers/net/wireless/virtual/mac80211_hwsim_nan.h:18\n\ndrivers/net/wireless/virtual/Kconfig=1=config MAC80211_HWSIM\n--\ndrivers/net/wireless/virtual/Kconfig-7-\t needed for normal wireless LAN usage and is only for testing. See\ndrivers/net/wireless/virtual/Kconfig:8:\t Documentation/networking/mac80211_hwsim for more information on how\ndrivers/net/wireless/virtual/Kconfig-9-\t to use this tool.\n--\ndrivers/net/wireless/virtual/Kconfig-11-\t To compile this driver as a module, choose M here: the module will be\ndrivers/net/wireless/virtual/Kconfig:12:\t called mac80211_hwsim. If unsure, say N.\ndrivers/net/wireless/virtual/Kconfig-13-\n--\ndrivers/net/wireless/virtual/Makefile:1:obj-$(CONFIG_MAC80211_HWSIM)\t+= mac80211_hwsim.o\ndrivers/net/wireless/virtual/Makefile:2:mac80211_hwsim-objs\t\t+= mac80211_hwsim_main.o\ndrivers/net/wireless/virtual/Makefile:3:mac80211_hwsim-objs\t\t+= mac80211_hwsim_nan.o\ndrivers/net/wireless/virtual/Makefile-4-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-2-/*\ndrivers/net/wireless/virtual/mac80211_hwsim.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211\ndrivers/net/wireless/virtual/mac80211_hwsim.h-4- * Copyright (c) 2008, Jouni Malinen \u003cj@w1.fi\u003e\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h=23=enum hwsim_tx_control_flags {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-33- * entities such as wmediumd to receive and process all broadcasted\ndrivers/net/wireless/virtual/mac80211_hwsim.h:34: * frames from a mac80211_hwsim radio device.\ndrivers/net/wireless/virtual/mac80211_hwsim.h-35- *\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-42- * Once registered the user application has to take responsibility of\ndrivers/net/wireless/virtual/mac80211_hwsim.h:43: * broadcasting the frames to all listening mac80211_hwsim radio\ndrivers/net/wireless/virtual/mac80211_hwsim.h-44- * interfaces.\n--\ndrivers/net/wireless/virtual/mac80211_hwsim.h-55- * @HWSIM_CMD_REGISTER: request to register and received all broadcasted\ndrivers/net/wireless/virtual/mac80211_hwsim.h:56: *\tframes by any mac80211_hwsim radio device.\ndrivers/net/wireless/virtual/mac80211_hwsim.h-57- * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-2-/*\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-4- * Copyright (c) 2008, Jouni Malinen \u003cj@w1.fi\u003e\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-13-#include \u003cnet/mac80211.h\u003e\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:14:#include \"mac80211_hwsim.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:15:#include \"mac80211_hwsim_nan.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-16-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h=27=struct hwsim_sta_priv {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-37-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:38:struct mac80211_hwsim_link_data {\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-39-\tu32 link_id;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-50-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:51:struct mac80211_hwsim_data {\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-52-\tstruct list_head list;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-65-\t/* Storage space for channels, etc. */\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:66:\tstruct mac80211_hwsim_phy_data *phy_data;\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-67-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-144-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:145:\tstruct mac80211_hwsim_link_data link_data[IEEE80211_MLD_MAX_NUM_LINKS];\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-146-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:147:\tstruct mac80211_hwsim_nan_data nan;\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-148-};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h=151=extern struct list_head hwsim_radios;\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-152-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:153:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-154-\t\t\t\t u64 tsf);\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:155:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-156-\t\t\t\t ktime_t ts);\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-157-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:158:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-159-\t\t\t struct ieee80211_vif *vif);\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-160-\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h:161:void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,\ndrivers/net/wireless/virtual/mac80211_hwsim_i.h-162-\t\t\t struct sk_buff *skb,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-2-/*\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-4- * Copyright (c) 2008, Jouni Malinen \u003cj@w1.fi\u003e\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-40-#include \u003clinux/string.h\u003e\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:41:#include \"mac80211_hwsim.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:42:#include \"mac80211_hwsim_i.h\"\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-43-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=335=static const struct class hwsim_class = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:336:\t.name\t= \"mac80211_hwsim\"\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-337-};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=604=hwsim_vendor_test_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] = {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-607-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:608:static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-609-\t\t\t\t\t struct wireless_dev *wdev,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-630-\t *\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:631:\t * event_idx = 0 (index in mac80211_hwsim_vendor_commands)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-632-\t */\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-658-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:659:static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-660-\t{\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-663-\t\t.flags = WIPHY_VENDOR_CMD_NEED_NETDEV,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:664:\t\t.doit = mac80211_hwsim_vendor_cmd_test,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-665-\t\t.policy = hwsim_vendor_test_policy,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-670-/* Advertise support vendor specific events */\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:671:static const struct nl80211_vendor_cmd_info mac80211_hwsim_vendor_events[] = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-672-\t{ .vendor_id = OUI_QCA, .subcmd = 1 },\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=679=static int hwsim_radios_generation = 1;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-680-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:681:static struct platform_driver mac80211_hwsim_driver = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-682-\t.driver = {\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:683:\t\t.name = \"mac80211_hwsim\",\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-684-\t},\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=687=static const struct rhashtable_params hwsim_rht_params = {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-690-\t.key_len = ETH_ALEN,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:691:\t.key_offset = offsetof(struct mac80211_hwsim_data, addresses[1]),\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:692:\t.head_offset = offsetof(struct mac80211_hwsim_data, rht),\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-693-};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=704=struct hwsim_radiotap_ack_hdr {\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-711-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:712:static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-713-{\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=909=static DECLARE_WORK(hwsim_virtio_rx, hwsim_virtio_rx_work);\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-910-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:911:static int hwsim_tx_virtio(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-912-\t\t\t struct sk_buff *skb)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-939-/* cause a linker error if this ends up being needed */\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:940:extern int hwsim_tx_virtio(struct mac80211_hwsim_data *data,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-941-\t\t\t struct sk_buff *skb);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=980=static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-981-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:982:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-983-\tstruct hwsim_vif_priv *vp = (void *)vif-\u003edrv_priv;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1005-\trcu_read_lock();\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1006:\tmac80211_hwsim_tx_frame(data-\u003ehw, skb,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1007-\t\t\t\trcu_dereference(vif-\u003ebss_conf.chanctx_conf)-\u003edef.chan);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1010-\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1011:static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1012-\t\t\t\tstruct ieee80211_vif *vif, int ps)\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1043-\trcu_read_lock();\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1044:\tmac80211_hwsim_tx_frame(data-\u003ehw, skb,\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1045-\t\t\t\trcu_dereference(vif-\u003ebss_conf.chanctx_conf)-\u003edef.chan);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1050=static void hwsim_send_nullfunc_ps(void *dat, u8 *mac,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1052-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1053:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1054-\thwsim_send_nullfunc(data, mac, vif, 1);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1057=static void hwsim_send_nullfunc_no_ps(void *dat, u8 *mac,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1059-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1060:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1061-\thwsim_send_nullfunc(data, mac, vif, 0);\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1064=static int hwsim_fops_ps_read(void *dat, u64 *val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1065-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1066:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1067-\t*val = data-\u003eps;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1071=static int hwsim_fops_ps_write(void *dat, u64 val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1072-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1073:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1074-\tenum ps_mode old_ps;\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1111=static int hwsim_write_simulate_radar(void *dat, u64 val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1112-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1113:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1114-\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1123=static ssize_t hwsim_background_cac_write(struct file *file,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1126-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1127:\tstruct mac80211_hwsim_data *data = file-\u003eprivate_data;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1128-\tchar buf[8] = {};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1178=static ssize_t hwsim_simulate_incumbent_signal_write(struct file *file,\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1181-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1182:\tstruct mac80211_hwsim_data *data = file-\u003eprivate_data;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1183-\tstruct hwsim_chanctx_iter_arg arg = {};\n--\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c=1221=static int hwsim_fops_group_read(void *dat, u64 *val)\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1222-{\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c:1223:\tstruct mac80211_hwsim_data *data = dat;\ndrivers/net/wireless/virtual/mac80211_hwsim_main.c-1224-\t*val = data-\u003egroup;\n--\n\n"
} |
| 43/2 | 2026/11/22 12:55 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 51597 output: 33 thoughts: 2006 Thoughts: **Focus Symbol Identification and Analysis** Okay, let's break this down. My primary goal here is to identify the most effective symbols to target for fuzzing based on the provided diff. The focus is on finding *specific* and *non-ubiquitous* functions directly related to the code changes, as per the guidelines. Initially, I identified `mac80211_hwsim_write_tsf` and `mac80211_hwsim_tx_frame` as potential candidates, noting the call chain. However, given that `mac80211_hwsim_write_tsf` is static, I need to find its non-static caller functions, like `mac80211_hwsim_tx_frame`. The diff also directly modifies a number of functions, so let's review: I then compiled a list of functions touched by the diff, making note of their static/non-static status: `bpf_prog_test_run_sk_lookup`, `verify_address_len`, `ieee80211_process_addba_request`, `ieee80211_process_addba_resp`, `current_check_access_socket` / `hook_socket_connect`, `mac80211_hwsim_write_tsf` / `mac80211_hwsim_tx_frame`, `validate_beacon_head`, `cfg80211_parse_ap_info`, `uvc_v4l2_put_xu_mapping` / `uvc_v4l2_put_xu_query`, `__udp4_lib_mcast_deliver` / `__udp6_lib_mcast_deliver`, and `btmrvl_process_event`. I then made sure the functions I was selecting as candidates are not generic, ubiquitous functions, and are feature specific to the changes. I checked `btmrvl_process_event` as it had hardware implications, which I needed to know before selecting it. `verify_address_len` is static, so I had to determine if it could be inlined. I considered its call sites and callers to determine whether or not it should be selected. Finally, I considered whether to include static functions, considering the implications of inlining and how the symbol coverage works. Because I know that a static function *can* be targeted if it is not inlined, and also *can* be targeted if its address is taken, I carefully analyzed the functions. The key is to find functions where a caller exercises the static inline function. So, after this analysis, my *best* options are: - `bpf_prog_test_run_sk_lookup` - `ieee80211_process_addba_request` - `ieee80211_process_addba_resp` - `hook_socket_connect` (and its caller `current_check_access_socket`) - `validate_beacon_head` - `__udp4_lib_mcast_deliver` - `__udp6_lib_mcast_deliver` These represent the most suitable entry points for focused fuzzing based on the current changes. They are all non-ubiquitous entry points to the code that has been changed, or static functions whose addresses are taken. |
| 44/2 | 2026/11/22 12:55 | tool | grepper |
0mArgs:{
"Expression": "hook_socket_",
"PathPrefixes": [
"security/landlock/net.c"
]
}Results: {
"Output": "security/landlock/net.c=309=static int current_check_autobind_udp_socket(struct socket *const sock)\n--\nsecurity/landlock/net.c-346-\nsecurity/landlock/net.c:347:static int hook_socket_bind(struct socket *const sock,\nsecurity/landlock/net.c-348-\t\t\t struct sockaddr *const address, const int addrlen)\n--\nsecurity/landlock/net.c-362-\nsecurity/landlock/net.c:363:static int hook_socket_connect(struct socket *const sock,\nsecurity/landlock/net.c-364-\t\t\t struct sockaddr *const address,\n--\nsecurity/landlock/net.c-391-\nsecurity/landlock/net.c:392:static int hook_socket_sendmsg(struct socket *const sock,\nsecurity/landlock/net.c-393-\t\t\t struct msghdr *const msg, const int size)\n--\nsecurity/landlock/net.c=423=static struct security_hook_list landlock_hooks[] __ro_after_init = {\nsecurity/landlock/net.c:424:\tLSM_HOOK_INIT(socket_bind, hook_socket_bind),\nsecurity/landlock/net.c:425:\tLSM_HOOK_INIT(socket_connect, hook_socket_connect),\nsecurity/landlock/net.c:426:\tLSM_HOOK_INIT(socket_sendmsg, hook_socket_sendmsg),\nsecurity/landlock/net.c-427-};\n"
} |
| 45/2 | 2026/11/22 12:55 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 54784 output: 36 thoughts: 107 Thoughts: Okay, let's see what we've got here. **Analyzing Potential Symbol Visibility in the Kernel** Right, so `hook_socket_connect` and `hook_socket_bind` are definitely staying put; they're getting their addresses passed around within `landlock_hooks`, so no chance of the compiler inlining those away. That means they're absolutely in `kallsyms`, and we can count on them being there. Now, I need to check something else. I'm curious about `__udp4_lib_mcast_deliver` and `__udp6_lib_mcast_deliver`. Are these functions declared as static or not? The static keyword is important, because static functions are internal to a compilation unit and are not visible outside it, so I should see the code for each of those in `net/ipv4/udp.c` and `net/ipv6/udp.c`, respectively, to be sure. This will let me confirm whether they are accessible externally, and therefore whether they will appear in `kallsyms`. Let's dig into the source and find out. |
| 46/2 | 2026/11/22 12:56 | tool | grepper |
0mArgs:{
"Expression": "__udp4_lib_mcast_deliver",
"PathPrefixes": [
"net/ipv4/"
]
}Results: {
"Output": "net/ipv4/udp.c=2492=bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)\n--\nnet/ipv4/udp.c-2508- */\nnet/ipv4/udp.c:2509:static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,\nnet/ipv4/udp.c-2510-\t\t\t\t struct udphdr *uh,\n--\nnet/ipv4/udp.c=2635=int udp_rcv(struct sk_buff *skb)\n--\nnet/ipv4/udp.c-2693-\tif (rt-\u003ert_flags \u0026 (RTCF_BROADCAST|RTCF_MULTICAST))\nnet/ipv4/udp.c:2694:\t\treturn __udp4_lib_mcast_deliver(net, skb, uh, saddr, daddr);\nnet/ipv4/udp.c-2695-\n"
} |
| 47/2 | 2026/11/22 12:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 55428 output: 39 thoughts: 373 Thoughts: **Analyzing Multicast Delivery and Configuration Dependencies** Okay, so I'm looking at `__udp4_lib_mcast_deliver`. It's a hefty function, too large to be inlined, and it handles multicast delivery. Given my expertise, I need to make sure I understand the dependencies. First, let's verify the configurations necessary for all relevant pieces. I need to make sure I get it all: 1. I see that `BPF_SYSCALL` is needed for `net/bpf/test_run.c` and specifically for that `bpf_prog_test_run_sk_lookup` function. Got it. 2. Then, there's `SECURITY_LANDLOCK` for `security/landlock/net.c`, specifically for `hook_socket_connect`. 3. Next, `MAC80211` is needed for wireless stuff, specifically `net/mac80211/agg-rx.c` which calls `ieee80211_process_addba_request` and also `agg-tx.c` calling `ieee80211_process_addba_resp`. 4. I also need to remember `CFG80211` for more wireless parts, including `net/wireless/nl80211.c` to validate `validate_beacon_head` and `scan.c` for `cfg80211_parse_ap_info`. 5. `MAC80211_HWSIM` pops up for drivers, so it's involved in `drivers/net/wireless/virtual/mac80211_hwsim_main.c`. 6. `NET_KEY` is necessary for `net/key/af_key.c`. 7. `INET` for `net/ipv4/udp.c` is important. 8. And finally, `IPV6` is required for `net/ipv6/udp.c`. Now, I'll move on to digging into Kconfig to verify dependencies. I'll start with `CONFIG_MAC80211`. |
| 48/2 | 2026/11/22 12:56 | tool | grepper |
0mArgs:{
"Expression": "config MAC80211\\b",
"PathPrefixes": [
"net/mac80211/"
]
}Results: {
"Output": "net/mac80211/Kconfig-1-# SPDX-License-Identifier: GPL-2.0-only\nnet/mac80211/Kconfig:2:config MAC80211\nnet/mac80211/Kconfig-3-\ttristate \"Generic IEEE 802.11 Networking Stack (mac80211)\"\n"
} |
| 49/2 | 2026/11/22 12:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 56418 output: 37 thoughts: 25 Thoughts: Okay, here's my interpretation of what I'm about to read in the Kconfig file, framed as my own thought process. **Analyzing the WiFi Configuration (Lines 1-20)** Alright, time to dive into `net/mac80211/Kconfig`. Based on the file path, I expect this to be the main configuration file for the mac80211 wireless subsystem within the Linux kernel. I'm going to quickly skim the first twenty lines to get the lay of the land, probably focusing on the top-level configuration options and how they're structured. My initial goal is to understand the scope of what we can configure here - is it broad, or is it specific to certain drivers or features? Are there any obvious dependencies on other kernel components? I’m looking for the overall framework and how the choices are presented to the user. I'll likely be assessing the use of `config` statements, `tristate` versus `bool` options, and the general way options are grouped and described. I’m also looking for any early hints on how modular the mac80211 implementation is; are we talking about a massive, monolithic block, or is there a clear architectural division that the Kconfig reveals? I need to build a mental map of the configuration space here, so I can dive deeper into specific areas later if necessary. |
| 50/2 | 2026/11/22 12:56 | tool | read-file |
0mArgs:{
"File": "net/mac80211/Kconfig",
"FirstLine": 1,
"LineCount": 20
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0-only\n 2:\tconfig MAC80211\n 3:\t\ttristate \"Generic IEEE 802.11 Networking Stack (mac80211)\"\n 4:\t\tdepends on CFG80211\n 5:\t\tselect CRYPTO\n 6:\t\tselect CRYPTO_LIB_AES_CBC_MACS\n 7:\t\tselect CRYPTO_LIB_ARC4\n 8:\t\tselect CRYPTO_AES\n 9:\t\tselect CRYPTO_CCM\n 10:\t\tselect CRYPTO_GCM\n 11:\t\tselect CRC32\n 12:\t\thelp\n 13:\t\t This option enables the hardware independent IEEE 802.11\n 14:\t\t networking stack.\n 15:\t\n 16:\tcomment \"CFG80211 needs to be enabled for MAC80211\"\n 17:\t\tdepends on CFG80211=n\n 18:\t\n 19:\tif MAC80211 != n\n 20:\t\n"
} |
| 51/2 | 2026/11/22 12:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 57052 output: 36 thoughts: 45 Thoughts: Here's my take on those thoughts: **Analyzing the MAC80211 Dependency Landscape** Okay, so I'm thinking about MAC80211 right now. It's pretty fundamental, obviously, and my mental model is always that it hinges on CFG80211. Standard stuff. I need to get a clear picture of its dependencies for an upcoming project. To get more clarity on that, my next step is to drill down into the `drivers/net/wireless/virtual/Kconfig` file. I'm specifically interested in the MAC80211_HWSIM configuration and its dependencies – need to nail down the precise linkages within that section. This is all about verifying and solidifying my understanding of the architecture, so I'm ready to move forward. |
| 52/2 | 2026/11/22 12:56 | tool | read-file |
0mArgs:{
"File": "drivers/net/wireless/virtual/Kconfig",
"FirstLine": 1,
"LineCount": 20
}Results: {
"Contents": " 1:\tconfig MAC80211_HWSIM\n 2:\t\ttristate \"Simulated radio testing tool for mac80211\"\n 3:\t\tdepends on MAC80211\n 4:\t\thelp\n 5:\t\t This driver is a developer testing tool that can be used to test\n 6:\t\t IEEE 802.11 networking stack (mac80211) functionality. This is not\n 7:\t\t needed for normal wireless LAN usage and is only for testing. See\n 8:\t\t Documentation/networking/mac80211_hwsim for more information on how\n 9:\t\t to use this tool.\n 10:\t\n 11:\t\t To compile this driver as a module, choose M here: the module will be\n 12:\t\t called mac80211_hwsim. If unsure, say N.\n 13:\t\n 14:\tconfig VIRT_WIFI\n 15:\t\ttristate \"Wifi wrapper for ethernet drivers\"\n 16:\t\tdepends on CFG80211\n 17:\t\thelp\n 18:\t\t This option adds support for ethernet connections to appear as if they\n 19:\t\t are wifi connections through a special rtnetlink device.\n 20:\t\n"
} |
| 53/2 | 2026/11/22 12:56 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 57629 output: 23 thoughts: 170 Thoughts: **Kernel Configuration Quandary** Okay, so I'm diving into this kernel configuration stuff again. My immediate concern is the dependency of `MAC80211_HWSIM` on `MAC80211`. That's the baseline, nothing unexpected there. But now I'm thinking about `NET_KEY`. I need to figure out if it has any relevant dependencies. Right, that's defined in `net/xfrm/Kconfig`. Let me just quickly confirm what I already remember from earlier, that it *doesn't* have any specific `depends on` clauses; instead, it `select`s `XFRM_ALGO`. Okay, good. Now, let's switch gears and consider `CONFIG_SECURITY_LANDLOCK`. Looking at its configuration, it depends on `SECURITY`, and it also `select`s `SECURITY_NETWORK` and `SECURITY_PATH`. So, we're dealing with both `SECURITY` and `SECURITY_LANDLOCK` being significant considerations. That seems straightforward. Finally, I need to check out `CONFIG_BPF_SYSCALL`. I'll need to look into its configuration as well, so let me quickly navigate to `kernel/bpf/Kconfig`. |
| 54/2 | 2026/11/22 12:56 | tool | grepper |
0mArgs:{
"Expression": "config BPF_SYSCALL\\b"
}Results: {
"Output": "kernel/bpf/Kconfig=29=menu \"BPF subsystem\"\nkernel/bpf/Kconfig-30-\nkernel/bpf/Kconfig:31:config BPF_SYSCALL\nkernel/bpf/Kconfig-32-\tbool \"Enable bpf() system call\"\n"
} |
| 55/2 | 2026/11/22 12:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 58170 output: 34 thoughts: 19 Thoughts: Here's my summary, as though I'm reading and thinking about the Kconfig file: **Navigating the BPF Kernel Configuration** Okay, let's dive into the kernel's BPF configuration. I'm specifically interested in line 31 of `kernel/bpf/Kconfig`. I'm already pretty familiar with this area, so I know we're probably looking at some core feature enabling, or perhaps a dependency definition. Time to see what's what. Let's see if this gives us any new insights into build options, maybe some hints at new features, or possibly some optimization possibilities I hadn't considered. I expect it's likely relating to enabling some key BPF functionality, the availability of features, or maybe even architectural choices. Let's get to it. |
| 56/2 | 2026/11/22 12:57 | tool | read-file |
0mArgs:{
"File": "kernel/bpf/Kconfig",
"FirstLine": 30,
"LineCount": 20
}Results: {
"Contents": " 30:\t\n 31:\tconfig BPF_SYSCALL\n 32:\t\tbool \"Enable bpf() system call\"\n 33:\t\tselect BPF\n 34:\t\tselect IRQ_WORK\n 35:\t\tselect NEED_TASKS_RCU\n 36:\t\tselect TASKS_TRACE_RCU\n 37:\t\tselect BINARY_PRINTF\n 38:\t\tselect NET_SOCK_MSG if NET\n 39:\t\tselect NET_XGRESS if NET\n 40:\t\tselect PAGE_POOL if NET\n 41:\t\tdefault n\n 42:\t\thelp\n 43:\t\t Enable the bpf() system call that allows to manipulate BPF programs\n 44:\t\t and maps via file descriptors.\n 45:\t\n 46:\tconfig BPF_JIT\n 47:\t\tbool \"Enable BPF Just In Time compiler\"\n 48:\t\tdepends on BPF\n 49:\t\tdepends on HAVE_CBPF_JIT || HAVE_EBPF_JIT\n"
} |
| 57/2 | 2026/11/22 12:57 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 58658 output: 286 thoughts: 702 Thoughts: **Fuzzing Decision for the Patch**
Okay, let's break this down. First, this `BPF_SYSCALL` thing... it has no dependencies, it only selects things. So, no immediate red flags there. Now, let's methodically go through this analysis.
1. **WorthFuzzing**: It's true. The patch introduces the `struct_offsetofend` helper and refactors offset calculations in core subsystems like BPF, Landlock, AF\_KEY, IPv4/IPv6, mac80211, and virtual devices. That sounds like a textbook case for fuzzing, given the potential for subtle semantic shifts and latent bugs when you're messing with core infrastructure. The instructions are clear: if reachable, executable code is touched and the change doesn't fall into the negative categories (which it doesn't here), then `WorthFuzzing = true`.
2. **FocusSymbols**: Okay, what specific functions are being modified in reachable code? Let's make sure we're being precise and not just hitting ubiquitous symbols. We have:
* `bpf_prog_test_run_sk_lookup` (in `net/bpf/test_run.c`) – That's BPF-specific.
* `verify_address_len` (in `net/key/af_key.c`) – AF\_KEY specific.
* `hook_socket_connect` (in `security/landlock/net.c`) – Landlock specific.
* `ieee80211_process_addba_request` (in `net/mac80211/agg-rx.c`) – mac80211 specific.
* `ieee80211_process_addba_resp` (in `net/mac80211/agg-tx.c`) – mac80211 specific.
* `validate_beacon_head` (in `net/wireless/nl80211.c`) – wireless specific.
* `mac80211_hwsim_write_tsf` (in `drivers/net/wireless/virtual/mac80211_hwsim_main.c`) – mac80211 HW simulator specific.
* `__udp4_lib_mcast_deliver` (in `net/ipv4/udp.c`) – IPv4-specific, albeit perhaps more widely used.
So, it seems we have a good, focused set of symbols that are directly relevant to their respective features. They are not like a `filldir` or `__futex_hash` that are all over the place.
3. **EnableConfigs**: We'll need `BPF_SYSCALL`, `SECURITY`, `SECURITY_LANDLOCK`, `NET_KEY`, `CFG80211`, `MAC80211`, `MAC80211_HWSIM`, and `INET` enabled to test all the affected areas.
4. **Reasoning**: Refactoring offset calculations in core subsystems with reachable code modifications warrants fuzzing due to the potential for introducing subtle semantic shifts or uncovering latent kernel bugs. The specific functions are focused, and the configuration requirements are straightforward.
Everything checks out. I'm satisfied. Let's call `set-results`.
|
| 58/2 | 2026/11/22 12:57 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"BPF_SYSCALL",
"SECURITY",
"SECURITY_LANDLOCK",
"NET_KEY",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"INET"
],
"FocusSymbols": [
"bpf_prog_test_run_sk_lookup",
"verify_address_len",
"hook_socket_connect",
"ieee80211_process_addba_request",
"ieee80211_process_addba_resp",
"validate_beacon_head",
"mac80211_hwsim_write_tsf",
"__udp4_lib_mcast_deliver"
],
"Reasoning": "The patch introduces the struct_offsetofend macro helper and refactors offset calculations across multiple reachable core subsystems, including BPF syscall test runs, Landlock security hooks, AF_KEY socket validation, mac80211 wireless protocol frame handling, and UDP multicast delivery. Even though intended as a refactoring/cleanup, modifying offset calculations in reachable core networking, security, and BPF code warrants fuzzing to ensure no regressions or boundary evaluation discrepancies occur.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"SECURITY",
"SECURITY_LANDLOCK",
"NET_KEY",
"CFG80211",
"MAC80211",
"MAC80211_HWSIM",
"INET"
],
"FocusSymbols": [
"bpf_prog_test_run_sk_lookup",
"verify_address_len",
"hook_socket_connect",
"ieee80211_process_addba_request",
"ieee80211_process_addba_resp",
"validate_beacon_head",
"mac80211_hwsim_write_tsf",
"__udp4_lib_mcast_deliver"
],
"Reasoning": "The patch introduces the struct_offsetofend macro helper and refactors offset calculations across multiple reachable core subsystems, including BPF syscall test runs, Landlock security hooks, AF_KEY socket validation, mac80211 wireless protocol frame handling, and UDP multicast delivery. Even though intended as a refactoring/cleanup, modifying offset calculations in reachable core networking, security, and BPF code warrants fuzzing to ensure no regressions or boundary evaluation discrepancies occur.",
"WorthFuzzing": true
} |
| 59/1 | 2026/11/22 12:57 | action | If |
0mArgs:{
"WorthFuzzing": true
}Results: null |
| 60/2 | 2026/11/22 12:57 | agent | kmsan-evaluator |
0mModel:core Args: null Results: {
"KMSANReasoning": "The patch is a pure syntactic refactoring. It introduces the helper macro `struct_offsetofend(p, member)` in `include/linux/overflow.h` (defined as `(offsetofend(typeof(*(p)), member))`) and a Coccinelle script `scripts/coccinelle/api/struct_offsetof.cocci`, then systematically replaces instances of `offsetof(typeof(*(p)), member)` with `struct_offset(p, member)` and `offsetofend(typeof(*(p)), member)` with `struct_offsetofend(p, member)`.\n\nBecause the macro expansions are identical to the original expressions, the generated machine code and runtime behavior remain entirely unchanged. No changes are made to buffer allocations, memory initialization, data copying, or control flow, and no uninitialized memory hazards or information leak risks are created. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit e9ed11040ab7cc34826cc8cae2ae50d9d266f3ed
Author: syz-cluster <triage@syzkaller.com>
Date: Sun Nov 22 12:50:26 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c
index d449fbdde46406..cd98beaf6cb6ef 100644
--- a/drivers/bluetooth/btmrvl_main.c
+++ b/drivers/bluetooth/btmrvl_main.c
@@ -81,7 +81,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
struct btmrvl_event *event;
int ret = 0;
- if (skb->len <= offsetof(typeof(*event), data[0]))
+ if (skb->len <= struct_offset(event, data[0]))
return -EINVAL;
event = (struct btmrvl_event *) skb->data;
@@ -92,7 +92,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
switch (event->data[0]) {
case BT_EVENT_AUTO_SLEEP_MODE:
- if (skb->len <= offsetof(typeof(*event), data[2]))
+ if (skb->len <= struct_offset(event, data[2]))
return -EINVAL;
if (!event->data[2]) {
if (event->data[1] == BT_PS_ENABLE)
@@ -107,7 +107,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_HOST_SLEEP_CONFIG:
- if (skb->len <= offsetof(typeof(*event), data[3]))
+ if (skb->len <= struct_offset(event, data[3]))
return -EINVAL;
if (!event->data[3])
BT_DBG("gpio=%x, gap=%x", event->data[1],
@@ -117,7 +117,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_HOST_SLEEP_ENABLE:
- if (skb->len <= offsetof(typeof(*event), data[1]))
+ if (skb->len <= struct_offset(event, data[1]))
return -EINVAL;
if (!event->data[1]) {
adapter->hs_state = HS_ACTIVATED;
@@ -131,7 +131,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_MODULE_CFG_REQ:
- if (skb->len <= offsetof(typeof(*event), data[2]))
+ if (skb->len <= struct_offset(event, data[2]))
return -EINVAL;
if (priv->btmrvl_dev.sendcmdflag &&
event->data[1] == MODULE_BRINGUP_REQ) {
@@ -150,7 +150,7 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
break;
case BT_EVENT_POWER_STATE:
- if (skb->len <= offsetof(typeof(*event), data[1]))
+ if (skb->len <= struct_offset(event, data[1]))
return -EINVAL;
if (event->data[1] == BT_PS_SLEEP)
adapter->ps_state = PS_SLEEP;
diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
index 2365a6d8ca15f6..a751a972aea17d 100644
--- a/drivers/dma-buf/dma-resv.c
+++ b/drivers/dma-buf/dma-resv.c
@@ -108,7 +108,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int max_fences)
return NULL;
/* Given the resulting bucket size, recalculated max_fences. */
- list->max_fences = (size - offsetof(typeof(*list), table)) /
+ list->max_fences = (size - struct_offset(list, table)) /
sizeof(*list->table);
return list;
diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c
index a9cea09355ff4b..12b8cceb3d200e 100644
--- a/drivers/firmware/arm_scmi/base.c
+++ b/drivers/firmware/arm_scmi/base.c
@@ -340,7 +340,7 @@ static void *scmi_base_fill_custom_report(const struct scmi_protocol_handle *ph,
if (evt_id != SCMI_EVENT_BASE_ERROR_EVENT || sizeof(*p) < payld_sz)
return NULL;
- expected_sz = offsetof(typeof(*p), msg_reports);
+ expected_sz = struct_offset(p, msg_reports);
if (payld_sz < expected_sz)
return NULL;
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index b8f882a17c8f1d..e7dcaa1f2f58d6 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3124,9 +3124,9 @@ EXPORT_SYMBOL(drm_mode_find_dmt);
static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 type)
{
- BUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.pad1) != 2);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.type) != 3);
+ BUILD_BUG_ON(struct_offset(descriptor, pixel_clock) != 0);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.pad1) != 2);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.type) != 3);
return descriptor->pixel_clock == 0 &&
descriptor->data.other_data.pad1 == 0 &&
@@ -3135,7 +3135,7 @@ static bool is_display_descriptor(const struct detailed_timing *descriptor, u8 t
static bool is_detailed_timing_descriptor(const struct detailed_timing *descriptor)
{
- BUILD_BUG_ON(offsetof(typeof(*descriptor), pixel_clock) != 0);
+ BUILD_BUG_ON(struct_offset(descriptor, pixel_clock) != 0);
return descriptor->pixel_clock != 0;
}
@@ -3207,8 +3207,8 @@ is_rb(const struct detailed_timing *descriptor, void *data)
if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
return;
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.cvt.flags) != 15);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.cvt.flags) != 15);
if (descriptor->data.other_data.data.range.flags == DRM_EDID_CVT_SUPPORT_FLAG &&
descriptor->data.other_data.data.range.formula.cvt.flags & DRM_EDID_CVT_FLAGS_REDUCED_BLANKING)
@@ -3237,7 +3237,7 @@ find_gtf2(const struct detailed_timing *descriptor, void *data)
if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
return;
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);
if (descriptor->data.other_data.data.range.flags == DRM_EDID_SECONDARY_GTF_SUPPORT_FLAG)
*res = descriptor;
@@ -3251,7 +3251,9 @@ drm_gtf2_hbreak(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.hfreq_start_khz) != 12);
+ BUILD_BUG_ON(struct_offset(descriptor,
+ data.other_data.data.range.formula.gtf2.hfreq_start_khz
+ ) != 12);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.hfreq_start_khz * 2 : 0;
}
@@ -3263,7 +3265,7 @@ drm_gtf2_2c(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.c) != 13);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.c) != 13);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.c : 0;
}
@@ -3275,7 +3277,7 @@ drm_gtf2_m(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.m) != 14);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.m) != 14);
return descriptor ? le16_to_cpu(descriptor->data.other_data.data.range.formula.gtf2.m) : 0;
}
@@ -3287,7 +3289,7 @@ drm_gtf2_k(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.k) != 16);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.k) != 16);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.k : 0;
}
@@ -3299,7 +3301,7 @@ drm_gtf2_2j(const struct drm_edid *drm_edid)
drm_for_each_detailed_block(drm_edid, find_gtf2, &descriptor);
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.formula.gtf2.j) != 17);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.formula.gtf2.j) != 17);
return descriptor ? descriptor->data.other_data.data.range.formula.gtf2.j : 0;
}
@@ -3312,7 +3314,7 @@ get_timing_level(const struct detailed_timing *descriptor, void *data)
if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
return;
- BUILD_BUG_ON(offsetof(typeof(*descriptor), data.other_data.data.range.flags) != 10);
+ BUILD_BUG_ON(struct_offset(descriptor, data.other_data.data.range.flags) != 10);
switch (descriptor->data.other_data.data.range.flags) {
case DRM_EDID_DEFAULT_GTF_SUPPORT_FLAG:
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
index 9e01f8b2079aba..598c1271cae198 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
@@ -101,8 +101,8 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
* A gem object is embedded both in a struct ttm_buffer_object :/ and
* in a drm_i915_gem_object. Make sure they are aliased.
*/
- BUILD_BUG_ON(offsetof(typeof(*obj), base) !=
- offsetof(typeof(*obj), __do_not_access.base));
+ BUILD_BUG_ON(struct_offset(obj, base) !=
+ struct_offset(obj, __do_not_access.base));
spin_lock_init(&obj->vma.lock);
INIT_LIST_HEAD(&obj->vma.list);
diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index b2442f05825ee2..48a773b3cde925 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -263,7 +263,7 @@ static struct active_node *__active_lookup(struct i915_active *ref, u64 idx)
return it;
}
- BUILD_BUG_ON(offsetof(typeof(*it), node));
+ BUILD_BUG_ON(struct_offset(it, node));
/* While active, the tree can only be built; not destroyed */
GEM_BUG_ON(i915_active_is_idle(ref));
diff --git a/drivers/gpu/drm/i915/i915_sw_fence_work.c b/drivers/gpu/drm/i915/i915_sw_fence_work.c
index 366418108f78f4..c059bb1e9492ef 100644
--- a/drivers/gpu/drm/i915/i915_sw_fence_work.c
+++ b/drivers/gpu/drm/i915/i915_sw_fence_work.c
@@ -70,7 +70,7 @@ static void fence_release(struct dma_fence *fence)
i915_sw_fence_fini(&f->chain);
- BUILD_BUG_ON(offsetof(typeof(*f), dma));
+ BUILD_BUG_ON(struct_offset(f, dma));
dma_fence_free(&f->dma);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
index fe590a045d70af..279309d008f0c5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
@@ -1171,7 +1171,7 @@ r535_gsp_shared_init(struct nvkm_gsp *gsp)
cmdq->tx.msgCount = (cmdq->tx.size - cmdq->tx.entryOff) / cmdq->tx.msgSize;
cmdq->tx.writePtr = 0;
cmdq->tx.flags = 1;
- cmdq->tx.rxHdrOff = offsetof(typeof(*cmdq), rx.readPtr);
+ cmdq->tx.rxHdrOff = struct_offset(cmdq, rx.readPtr);
msgq = gsp->shm.msgq.ptr;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index a9136a6523cbac..247f6d9b449499 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2609,12 +2609,12 @@ static int vmw_cmd_dx_check_subresource(struct vmw_private *dev_priv,
};
} *cmd;
- BUILD_BUG_ON(offsetof(typeof(*cmd), r_body.sid) !=
- offsetof(typeof(*cmd), sid));
- BUILD_BUG_ON(offsetof(typeof(*cmd), i_body.sid) !=
- offsetof(typeof(*cmd), sid));
- BUILD_BUG_ON(offsetof(typeof(*cmd), u_body.sid) !=
- offsetof(typeof(*cmd), sid));
+ BUILD_BUG_ON(struct_offset(cmd, r_body.sid) !=
+ struct_offset(cmd, sid));
+ BUILD_BUG_ON(struct_offset(cmd, i_body.sid) !=
+ struct_offset(cmd, sid));
+ BUILD_BUG_ON(struct_offset(cmd, u_body.sid) !=
+ struct_offset(cmd, sid));
cmd = container_of(header, typeof(*cmd), header);
return vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index 5301e4f21ade0e..1662aeebf1349a 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -780,7 +780,7 @@ int bnxt_qplib_post_srq_recv(struct bnxt_qplib_srq *srq,
srqe->wqe_type = wqe->type;
srqe->flags = wqe->flags;
srqe->wqe_size = wqe->num_sge +
- ((offsetof(typeof(*srqe), data) + 15) >> 4);
+ ((struct_offset(srqe, data) + 15) >> 4);
srqe->wr_id[0] = cpu_to_le32((u32)next);
srq->swq[next].wr_id = wqe->wr_id;
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c
index 7dfaa01cda670b..df4d57c4e85e36 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c
@@ -287,7 +287,7 @@ static int alloc_cq_db(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq,
if (udata) {
if (has_db &&
- udata->outlen >= offsetofend(typeof(*resp), cap_flags)) {
+ udata->outlen >= struct_offsetofend(resp, cap_flags)) {
uctx = rdma_udata_to_drv_context(udata,
struct hns_roce_ucontext, ibucontext);
err = hns_roce_db_map_user(uctx, addr, &hr_cq->db);
@@ -378,7 +378,7 @@ static int set_cqe_size(struct hns_roce_cq *hr_cq, struct ib_udata *udata,
return 0;
}
- if (udata->inlen >= offsetofend(typeof(*ucmd), cqe_size)) {
+ if (udata->inlen >= struct_offsetofend(ucmd, cqe_size)) {
if (ucmd->cqe_size != HNS_ROCE_V2_CQE_SIZE &&
ucmd->cqe_size != HNS_ROCE_V3_CQE_SIZE) {
ibdev_err(&hr_dev->ib_dev,
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index c6c0dfdbdbc303..e46c6cc1e3ee63 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -836,9 +836,9 @@ static inline bool user_qp_has_sdb(struct hns_roce_dev *hr_dev,
struct hns_roce_ib_create_qp *ucmd)
{
return ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_RECORD_DB) &&
- udata->outlen >= offsetofend(typeof(*resp), cap_flags) &&
+ udata->outlen >= struct_offsetofend(resp, cap_flags) &&
hns_roce_qp_has_sq(init_attr) &&
- udata->inlen >= offsetofend(typeof(*ucmd), sdb_addr));
+ udata->inlen >= struct_offsetofend(ucmd, sdb_addr));
}
static inline bool user_qp_has_rdb(struct hns_roce_dev *hr_dev,
@@ -847,7 +847,7 @@ static inline bool user_qp_has_rdb(struct hns_roce_dev *hr_dev,
struct hns_roce_ib_create_qp_resp *resp)
{
return ((hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_RECORD_DB) &&
- udata->outlen >= offsetofend(typeof(*resp), cap_flags) &&
+ udata->outlen >= struct_offsetofend(resp, cap_flags) &&
hns_roce_qp_has_rq(init_attr));
}
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 644c2f1cd8e634..4cf876f4b7eaae 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -1108,7 +1108,7 @@ static int uvc_v4l2_get_xu_mapping(struct uvc_xu_control_mapping *kp,
static int uvc_v4l2_put_xu_mapping(const struct uvc_xu_control_mapping *kp,
struct uvc_xu_control_mapping32 __user *up)
{
- if (copy_to_user(up, kp, offsetof(typeof(*up), menu_info)) ||
+ if (copy_to_user(up, kp, struct_offset(up, menu_info)) ||
put_user(kp->menu_count, &up->menu_count))
return -EFAULT;
@@ -1147,7 +1147,7 @@ static int uvc_v4l2_get_xu_query(struct uvc_xu_control_query *kp,
static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
struct uvc_xu_control_query32 __user *up)
{
- if (copy_to_user(up, kp, offsetof(typeof(*up), data)))
+ if (copy_to_user(up, kp, struct_offset(up, data)))
return -EFAULT;
return 0;
}
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 96225132750695..efebabd1ae04d9 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1041,7 +1041,7 @@ static int rndis_filter_set_packet_filter(struct rndis_device *dev,
set = &request->request_msg.msg.set_req;
set->oid = RNDIS_OID_GEN_CURRENT_PACKET_FILTER;
set->info_buflen = sizeof(u32);
- set->info_buf_offset = offsetof(typeof(*set), info_buf);
+ set->info_buf_offset = struct_offset(set, info_buf);
memcpy(set->info_buf, &new_filter, sizeof(u32));
ret = rndis_filter_send_request(dev, request);
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 0982e60842b1c6..01bdc0e9635d34 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -736,7 +736,7 @@ static void iwl_parse_dbg_tlv_assert_tables(struct iwl_drv *drv,
u32 length = le32_to_cpu(tlv->length);
u32 addr;
- if (length < offsetof(typeof(*region), special_mem) +
+ if (length < struct_offset(region, special_mem) +
sizeof(region->special_mem))
return;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index e2382be8edd78d..5faa97a420d8ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -625,7 +625,7 @@ void iwl_mvm_rs_fw_rate_init(struct iwl_mvm *mvm,
cfg_cmd.sta_id = mvm_link_sta->sta_id;
lq_sta = &mvm_link_sta->lq_sta.rs_fw;
- memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));
+ memset(lq_sta, 0, struct_offset(lq_sta, pers));
rcu_read_unlock();
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index d1619a229d8f2b..da0669155a3b08 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -2939,7 +2939,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
lockdep_assert_held(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
/* clear all non-persistent lq data */
- memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));
+ memset(lq_sta, 0, struct_offset(lq_sta, pers));
sband = hw->wiphy->bands[band];
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c
index 0009a05511af17..a5a065275f18dc 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-v2.c
@@ -241,7 +241,7 @@ int iwl_pcie_ctxt_info_v2_alloc(struct iwl_trans *trans,
* optional; old devices _should_ be fine with a bigger size,
* but in simulation we check the size more precisely.
*/
- BUILD_BUG_ON(offsetofend(typeof(*prph_scratch), dram.common) +
+ BUILD_BUG_ON(struct_offsetofend(prph_scratch, dram.common) +
sizeof(prph_scratch->dram.fseq_img) !=
sizeof(*prph_scratch));
if (control_flags_ext & IWL_PRPH_SCRATCH_EXT_EXT_FSEQ)
@@ -249,8 +249,7 @@ int iwl_pcie_ctxt_info_v2_alloc(struct iwl_trans *trans,
cpu_to_le32(sizeof(*prph_scratch));
else
ctxt_info_v2->prph_scratch_size =
- cpu_to_le32(offsetofend(typeof(*prph_scratch),
- dram.common));
+ cpu_to_le32(struct_offsetofend(prph_scratch, dram.common));
ctxt_info_v2->cr_head_idx_arr_base_addr =
cpu_to_le64(trans_pcie->rxq->rb_stts_dma);
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 3d0c22db30a804..79b4bb78b17ab5 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -6167,7 +6167,7 @@ static void rtl8xxxu_c2hcmd_callback(struct work_struct *work)
case C2H_8723B_RA_REPORT:
bw = rarpt->txrate.bw;
- if (skb->len >= offsetofend(typeof(*c2h), ra_report.bw)) {
+ if (skb->len >= struct_offsetofend(c2h, ra_report.bw)) {
if (c2h->ra_report.bw == RTL8XXXU_CHANNEL_WIDTH_40)
bw = RATE_INFO_BW_40;
else
diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index 945fedcd375b62..d1a1a492d14674 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -159,7 +159,7 @@ static void rtw_fw_ra_report_iter(void *data, struct ieee80211_sta *sta)
rate = u8_get_bits(ra_rpt->rate_sgi, RTW_C2H_RA_RPT_RATE);
sgi = u8_get_bits(ra_rpt->rate_sgi, RTW_C2H_RA_RPT_SGI);
- if (ra_data->length >= offsetofend(typeof(*ra_rpt), bw))
+ if (ra_data->length >= struct_offsetofend(ra_rpt, bw))
bw = ra_rpt->bw;
else
bw = si->bw_mode;
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 5220f74d15d2c0..85b04a61092085 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -2605,7 +2605,7 @@ static void rtw89_vif_sync_bcn_tsf(struct rtw89_vif_link *rtwvif_link,
{
struct ieee80211_mgmt *mgmt = (typeof(mgmt))hdr;
- if (len < offsetof(typeof(*mgmt), u.beacon.variable))
+ if (len < struct_offset(mgmt, u.beacon.variable))
return;
WRITE_ONCE(rtwvif_link->sync_bcn_tsf, le64_to_cpu(mgmt->u.beacon.timestamp));
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 21b548c63c7836..a4b6514a0ce5ff 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -8067,11 +8067,11 @@ int rtw89_fw_h2c_scan_list_offload_be(struct rtw89_dev *rtwdev, int ch_num,
if (RTW89_CHK_FW_FEATURE(CH_INFO_BE_V0, &rtwdev->fw)) {
ver = 0;
- elem_size = offsetofend(typeof(*elem), w7);
+ elem_size = struct_offsetofend(elem, w7);
used_len = sizeof(*h2c) + elem_size * ch_num;
} else if (RTW89_CHK_FW_FEATURE(CH_INFO_BE_V1, &rtwdev->fw)) {
ver = 1;
- elem_size = offsetofend(typeof(*elem), w7);
+ elem_size = struct_offsetofend(elem, w7);
used_len = sizeof(*h2c) + elem_size * ch_num;
}
@@ -8350,10 +8350,10 @@ int rtw89_fw_h2c_scan_offload_be(struct rtw89_dev *rtwdev,
rtw89_scan_get_6g_disabled_chan(rtwdev, option);
if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V0, &rtwdev->fw)) {
- cfg_len = offsetofend(typeof(*h2c), w8);
+ cfg_len = struct_offsetofend(h2c, w8);
scan_offload_ver = 0;
} else if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V1, &rtwdev->fw)) {
- cfg_len = offsetofend(typeof(*h2c), w9);
+ cfg_len = struct_offsetofend(h2c, w9);
scan_offload_ver = 1;
} else if (RTW89_CHK_FW_FEATURE(SCAN_OFFLOAD_BE_V2, &rtwdev->fw)) {
scan_offload_ver = 2;
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
index 49ec2948c68ab7..f1c3938b429a8f 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c
@@ -1622,12 +1622,12 @@ static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
if (txrate)
bitrate = txrate->bitrate;
- if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
+ if (skb->len >= struct_offsetofend(mgmt, u.probe_resp.timestamp) &&
ieee80211_is_probe_resp(hdr->frame_control)) {
mgmt->u.probe_resp.timestamp =
cpu_to_le64(sim_time + data->tsf_offset +
24 * 8 * 10 / bitrate);
- } else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
+ } else if (skb->len >= struct_offsetofend(mgmt, u.beacon.timestamp) &&
ieee80211_is_beacon(mgmt->frame_control)) {
mgmt->u.beacon.timestamp = cpu_to_le64(sim_time +
data->tsf_offset +
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index 96dde19b15fa7a..df2a0dfe7cc3d5 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -460,7 +460,7 @@ static ssize_t sequence_store(struct device *dev, struct device_attribute *attr,
param = (struct ec_params_lightbar *)msg->data;
param->cmd = LIGHTBAR_CMD_SEQ;
param->seq.num = num;
- msg->outsize = offsetof(typeof(*param), seq) + sizeof(param->seq);
+ msg->outsize = struct_offset(param, seq) + sizeof(param->seq);
msg->insize = 0;
ret = lb_throttle();
if (ret)
@@ -508,7 +508,7 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,
* Bound the payload strictly by the maximum value the structural
* size field can natively support.
*/
- extra_bytes = offsetof(typeof(*param), set_program_ex) +
+ extra_bytes = struct_offset(param, set_program_ex) +
sizeof(param->set_program_ex);
max_size = min_t(size_t, ec->ec_dev->max_request - extra_bytes,
type_max(typeof(param->set_program_ex.size)));
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 20b1aef455c4f4..159daefd249ed2 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -185,7 +185,7 @@ qla2x00_chk_ms_status(scsi_qla_host_t *vha, ms_iocb_entry_t *ms_pkt,
comp_status, ct_rsp->header.response);
ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha,
0x2078, ct_rsp,
- offsetof(typeof(*ct_rsp), rsp));
+ struct_offset(ct_rsp, rsp));
rval = QLA_INVALID_COMMAND;
} else
rval = QLA_SUCCESS;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 59ec5605930b7d..251c95d62fd015 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3225,7 +3225,7 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t loop_id,
mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc;
uint32_t *iter = (uint32_t *)stats;
- ushort dwords = offsetof(typeof(*stats), link_up_cnt)/sizeof(*iter);
+ ushort dwords = struct_offset(stats, link_up_cnt) / sizeof(*iter);
struct qla_hw_data *ha = vha->hw;
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1084,
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3c412c7fb6fe76..8e6a953dc3f762 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -6263,7 +6263,7 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha,
if (qla25xx_rdp_rsp_reduce_size(vha, purex)) {
rsp_payload_length =
- offsetof(typeof(*rsp_payload), optical_elmt_desc);
+ struct_offset(rsp_payload, optical_elmt_desc);
ql_dbg(ql_dbg_init, vha, 0x0181,
"Reducing RSP payload length to %u bytes...\n",
rsp_payload_length);
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index f96b9eb15126b4..814988895620b9 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -7,7 +7,7 @@
#include "qla_tmpl.h"
#define ISPREG(vha) (&(vha)->hw->iobase->isp24)
-#define IOBAR(reg) offsetof(typeof(*(reg)), iobase_addr)
+#define IOBAR(reg) struct_offset(reg, iobase_addr)
#define IOBASE(vha) IOBAR(ISPREG(vha))
#define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL)
@@ -722,7 +722,7 @@ static struct qla27xx_fwdt_entry *
qla27xx_fwdt_entry_t275(struct scsi_qla_host *vha,
struct qla27xx_fwdt_entry *ent, void *buf, ulong *len)
{
- ulong offset = offsetof(typeof(*ent), t275.buffer);
+ ulong offset = struct_offset(ent, t275.buffer);
ulong length = le32_to_cpu(ent->t275.length);
ulong size = le32_to_cpu(ent->hdr.size);
void *buffer = ent->t275.buffer;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index bec6ca38375bd6..09ee87ebd5d1a5 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -570,7 +570,7 @@ fc_host_post_fc_event(struct Scsi_Host *shost, u32 event_number,
event->event_code = event_code;
if (data_len)
memcpy(event->event_data_flex, data_buf, data_len);
- padding = len - offsetof(typeof(*event), event_data_flex) - data_len;
+ padding = len - struct_offset(event, event_data_flex) - data_len;
memset(event->event_data_flex + data_len, 0, padding);
nlmsg_multicast(scsi_nl_sock, skb, 0, SCSI_NL_GRP_FC_EVENTS,
diff --git a/fs/readdir.c b/fs/readdir.c
index f2288841337ad1..858ee501d4f735 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -22,7 +22,7 @@
#include <linux/compat.h>
#include <linux/uaccess.h>
-#define dirent_size(dirent, len) offsetof(typeof(*(dirent)), d_name[len])
+#define dirent_size(dirent, len) struct_offset(dirent, d_name[len])
/*
* Some filesystems were never converted to '->iterate_shared()'
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 68f05a52605f4f..a777c5ee6dc944 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -3200,7 +3200,7 @@ struct inode *cifs_create_reparse_inode(struct cifs_open_info_data *data,
io_req->ParameterCount = io_req->TotalParameterCount;
io_req->ParameterOffset = cpu_to_le32(0);
io_req->DataCount = io_req->TotalDataCount;
- io_req->DataOffset = cpu_to_le32(offsetof(typeof(*io_req), Data));
+ io_req->DataOffset = cpu_to_le32(struct_offset(io_req, Data));
io_req->SetupCount = 4;
io_req->SubCommand = cpu_to_le16(NT_TRANSACT_IOCTL);
io_req->FunctionCode = cpu_to_le32(FSCTL_SET_REPARSE_POINT);
@@ -5973,7 +5973,7 @@ int CIFSSMBSetPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
param_offset = offsetof(struct smb_com_transaction2_spi_req,
InformationLevel);
offset = param_offset + params;
- data_offset = (char *)pSMB + offsetof(typeof(*pSMB), hdr.Protocol) + offset;
+ data_offset = (char *)pSMB + struct_offset(pSMB, hdr.Protocol) + offset;
pSMB->ParameterOffset = cpu_to_le16(param_offset);
pSMB->DataOffset = cpu_to_le16(offset);
pSMB->SetupCount = 1;
diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
index 3a27773186ae43..ac6db460a942a3 100644
--- a/fs/smb/client/reparse.c
+++ b/fs/smb/client/reparse.c
@@ -1042,7 +1042,8 @@ static int parse_reparse_wsl_symlink(struct reparse_wsl_symlink_data_buffer *buf
struct cifs_open_info_data *data)
{
int len = le16_to_cpu(buf->ReparseDataLength);
- int data_offset = offsetof(typeof(*buf), Target) - offsetof(typeof(*buf), Version);
+ int data_offset = struct_offset(buf, Target) - struct_offset(buf,
+ Version);
int symname_utf8_len;
__le16 *symname_utf16;
int symname_utf16_len;
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index f909e2b25158a8..78e836ef76eeeb 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -306,7 +306,7 @@ xchk_xattr_local_entry(
char *name_end;
unsigned int namesize;
- name_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]);
+ name_end = (char *)lentry + struct_offset(lentry, nameval[0]);
if (name_end > buf_end) {
xchk_da_set_corrupt(ds, level);
return 0;
@@ -341,7 +341,7 @@ xchk_xattr_remote_entry(
char *name_end;
unsigned int namesize;
- name_end = (char *)rentry + offsetof(typeof(*rentry), name[0]);
+ name_end = (char *)rentry + struct_offset(rentry, name[0]);
if (name_end > buf_end) {
xchk_da_set_corrupt(ds, level);
return 0;
diff --git a/fs/xfs/scrub/attr_repair.c b/fs/xfs/scrub/attr_repair.c
index 720090895c20f5..901f9a126e65cb 100644
--- a/fs/xfs/scrub/attr_repair.c
+++ b/fs/xfs/scrub/attr_repair.c
@@ -294,7 +294,7 @@ xrep_xattr_salvage_local_attr(
* Decode the leaf local entry format. If something seems wrong, we
* junk the attribute.
*/
- name_end = (char *)lentry + offsetof(typeof(*lentry), nameval[0]);
+ name_end = (char *)lentry + struct_offset(lentry, nameval[0]);
if (name_end > buf_end)
return 0;
value = &lentry->nameval[lentry->namelen];
@@ -348,7 +348,7 @@ xrep_xattr_salvage_remote_attr(
* junk the attribute. Note that we should never find a zero-length
* remote attribute value.
*/
- name_end = (char *)rentry + offsetof(typeof(*rentry), name[0]);
+ name_end = (char *)rentry + struct_offset(rentry, name[0]);
if (name_end > buf_end)
return 0;
namesize = xfs_attr_leaf_entsize_remote(rentry->namelen);
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
index d99e2a73272306..a90dcc92ca9754 100644
--- a/fs/xfs/scrub/dir.c
+++ b/fs/xfs/scrub/dir.c
@@ -364,7 +364,7 @@ xchk_dir_check_entry(
unsigned int advance;
/* must have namelen */
- advance = offsetof(typeof(*dep), name);
+ advance = struct_offset(dep, name);
if (iter_off + advance >= end) {
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
return -1;
@@ -464,7 +464,7 @@ xchk_dir_rec(
int advance;
/* must have freetag */
- advance = offsetof(typeof(*dup), length);
+ advance = struct_offset(dup, length);
if (iter_off + advance >= end) {
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
goto out_relse;
diff --git a/fs/xfs/scrub/dir_repair.c b/fs/xfs/scrub/dir_repair.c
index 518e15d93d3b42..c7d234b592c217 100644
--- a/fs/xfs/scrub/dir_repair.c
+++ b/fs/xfs/scrub/dir_repair.c
@@ -501,7 +501,7 @@ xrep_dir_recover_entry(
int error;
/* must have namelen */
- advance = offsetof(typeof(*dep), name);
+ advance = struct_offset(dep, name);
if (offset + advance >= end)
return 0;
@@ -546,7 +546,7 @@ xrep_dir_recover_data(
return error;
/* must have freetag */
- advance = offsetof(typeof(*dup), length);
+ advance = struct_offset(dup, length);
if (offset + advance >= end)
break;
diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index d0f04436343e5f..c029d68daeca1b 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -464,6 +464,18 @@ static __always_inline size_t __must_check size_sub(size_t minuend, size_t subtr
*/
#define struct_offset(p, member) (offsetof(typeof(*(p)), member))
+/**
+ * struct_offsetofend() - Calculate the end of a member within a struct
+ * @p: Pointer to the struct
+ * @member: Name of the member to get the end offset of
+ *
+ * Calculates the offset of the end of a particular @member of the structure
+ * pointed to by @p.
+ *
+ * Return: number of bytes to the end of @member.
+ */
+#define struct_offsetofend(p, member) (offsetofend(typeof(*(p)), member))
+
/**
* __DEFINE_FLEX() - helper macro for DEFINE_FLEX() family.
* Enables caller macro to pass arbitrary trailing expressions
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index a240638f69e5c6..a7ef407e1e93a3 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -388,7 +388,8 @@ __futex_hash(union futex_key *key, struct futex_private_hash *fph, struct futex_
}
#endif
- hash = jhash2((u32 *)key, offsetof(typeof(*key), both.offset) / sizeof(u32),
+ hash = jhash2((u32 *)key,
+ struct_offset(key, both.offset) / sizeof(u32),
key->both.offset);
if (node == FUTEX_NO_NODE) {
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index d6c9dc62182ee4..519c4de7cfe2b9 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -1613,7 +1613,7 @@ int bpf_prog_test_run_sk_lookup(struct bpf_prog *prog, const union bpf_attr *kat
if (user_ctx->sk)
goto out;
- if (!range_is_zero(user_ctx, offsetofend(typeof(*user_ctx), local_port), sizeof(*user_ctx)))
+ if (!range_is_zero(user_ctx, struct_offsetofend(user_ctx, local_port), sizeof(*user_ctx)))
goto out;
if (user_ctx->local_port > U16_MAX) {
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index d42d776af273e4..0db29c6fd3d3ca 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -451,8 +451,8 @@ EXPORT_SYMBOL(ip_output);
*/
static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4)
{
- BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) !=
- offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr));
+ BUILD_BUG_ON(struct_offset(fl4, daddr) !=
+ struct_offset(fl4, saddr) + sizeof(fl4->saddr));
iph->saddr = fl4->saddr;
iph->daddr = fl4->daddr;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2e5562f353f85d..3dfb60b67fe980 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2526,7 +2526,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = 0;
hslot = udp_hashslot(udptable, net, hnum);
use_hash2 = hslot->count > 10;
- offset = offsetof(typeof(*sk), sk_node);
+ offset = struct_offset(sk, sk_node);
if (use_hash2) {
hash2_any = ipv4_portaddr_hash(net, htonl(INADDR_ANY), hnum) &
@@ -2534,7 +2534,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = ipv4_portaddr_hash(net, daddr, hnum) & udptable->mask;
start_lookup:
hslot = &udptable->hash2[hash2].hslot;
- offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
+ offset = struct_offset(sk, __sk_common.skc_portaddr_node);
}
sk_for_each_entry_offset_rcu(sk, node, &hslot->head, offset) {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 9dcefa16252235..6b396a4eb2b953 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -962,7 +962,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = 0;
hslot = udp_hashslot(udptable, net, hnum);
use_hash2 = hslot->count > 10;
- offset = offsetof(typeof(*sk), sk_node);
+ offset = struct_offset(sk, sk_node);
if (use_hash2) {
hash2_any = ipv6_portaddr_hash(net, &in6addr_any, hnum) &
@@ -970,7 +970,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
hash2 = ipv6_portaddr_hash(net, daddr, hnum) & udptable->mask;
start_lookup:
hslot = &udptable->hash2[hash2].hslot;
- offset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);
+ offset = struct_offset(sk, __sk_common.skc_portaddr_node);
}
sk_for_each_entry_offset_rcu(sk, node, &hslot->head, offset) {
diff --git a/net/key/af_key.c b/net/key/af_key.c
index d215b33b7492c2..20016a2770f789 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -384,7 +384,7 @@ static int verify_address_len(const void *p)
int len;
if (sp->sadb_address_len <
- DIV_ROUND_UP(sizeof(*sp) + offsetofend(typeof(*addr), sa_family),
+ DIV_ROUND_UP(sizeof(*sp) + struct_offsetofend(addr, sa_family),
sizeof(uint64_t)))
return -EINVAL;
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 01d6703767c638..72f78c4a58d424 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -493,8 +493,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
ieee80211_retrieve_addba_ext_data(sta,
mgmt->u.action.addba_req.variable,
len -
- offsetof(typeof(*mgmt),
- u.action.addba_req.variable),
+ struct_offset(mgmt, u.action.addba_req.variable),
&buf_size);
__ieee80211_start_rx_ba_session(sta, dialog_token, timeout,
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index f3ecdd8601a042..58a13cddee2e85 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -990,8 +990,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
ieee80211_retrieve_addba_ext_data(sta,
mgmt->u.action.addba_resp.variable,
- len - offsetof(typeof(*mgmt),
- u.action.addba_resp.variable),
+ len - struct_offset(mgmt, u.action.addba_resp.variable),
&buf_size);
buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes);
diff --git a/net/mac80211/parse.c b/net/mac80211/parse.c
index f3c5a9f6ec7c0e..e5a752e674f795 100644
--- a/net/mac80211/parse.c
+++ b/net/mac80211/parse.c
@@ -1068,7 +1068,7 @@ ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params)
bool inside_multilink = false;
BUILD_BUG_ON(sizeof(empty_non_inheritance) != empty_non_inheritance[1] + 2);
- BUILD_BUG_ON(offsetof(typeof(*elems_parse), elems) != 0);
+ BUILD_BUG_ON(struct_offset(elems_parse, elems) != 0);
/* cannot parse for both a specific link and non-transmitted BSS */
if (WARN_ON(params->link_id >= 0 && params->bss))
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 8ae01c277fd265..eb2c034493c4f6 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -1767,7 +1767,7 @@ ieee80211_process_tdls_channel_switch_resp(struct ieee80211_sub_if_data *sdata,
struct ieee80211_tdls_data *tf = (void *)skb->data;
bool local_initiator;
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
- int baselen = offsetof(typeof(*tf), u.chan_switch_resp.variable);
+ int baselen = struct_offset(tf, u.chan_switch_resp.variable);
struct ieee80211_tdls_ch_sw_params params = {};
int ret;
@@ -1868,7 +1868,7 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
enum nl80211_band band;
struct ieee80211_tdls_data *tf = (void *)skb->data;
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
- int baselen = offsetof(typeof(*tf), u.chan_switch_req.variable);
+ int baselen = struct_offset(tf, u.chan_switch_req.variable);
struct ieee80211_tdls_ch_sw_params params = {};
int ret = 0;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e7dd32880598fd..9b735caaf2b7e6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -333,7 +333,7 @@ static int validate_beacon_head(const struct nlattr *attr,
unsigned int fixedlen, hdrlen;
bool s1g_bcn;
- if (len < offsetofend(typeof(*mgmt), frame_control))
+ if (len < struct_offsetofend(mgmt, frame_control))
goto err;
s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control);
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5cd3880ee3841d..4fc1bf251c15d8 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -707,7 +707,7 @@ static bool valid_country(const u8 *data, unsigned int size,
unsigned int i;
/* make sure we can read len/n_rules */
- if ((u8 *)coll + offsetofend(typeof(*coll), n_rules) > data + size)
+ if ((u8 *)coll + struct_offsetofend(coll, n_rules) > data + size)
return false;
/* make sure base struct and all rules fit */
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 1c50a16c0e9bea..28a46d49de04f8 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -587,7 +587,7 @@ static int cfg80211_parse_ap_info(struct cfg80211_colocated_ap *entry,
bss_params = tbtt_info->bss_params;
/* Ignore disabled links */
- if (length >= offsetofend(typeof(*tbtt_info), mld_params)) {
+ if (length >= struct_offsetofend(tbtt_info, mld_params)) {
if (le16_get_bits(tbtt_info->mld_params.params,
IEEE80211_RNR_MLD_PARAMS_DISABLED_LINK))
return -EINVAL;
diff --git a/scripts/coccinelle/api/struct_offsetof.cocci b/scripts/coccinelle/api/struct_offsetof.cocci
new file mode 100644
index 00000000000000..5a30647d378720
--- /dev/null
+++ b/scripts/coccinelle/api/struct_offsetof.cocci
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/// Use struct_offset() family of macros
+///
+// Confidence: High
+// Options: --no-includes --ignore ./tools/
+
+virtual patch
+
+@offsetof depends on patch@
+expression ptr, member;
+@@
+- offsetof(typeof(*(ptr)), member)
++ struct_offset(ptr, member)
+@offsetofend depends on patch@
+expression ptr, member;
+@@
+- offsetofend(typeof(*(ptr)), member)
++ struct_offsetofend(ptr, member)
diff --git a/security/landlock/net.c b/security/landlock/net.c
index 8fd73cf4bd15b4..2f4bbd3bfe27c0 100644
--- a/security/landlock/net.c
+++ b/security/landlock/net.c
@@ -93,7 +93,7 @@ static int current_check_access_socket(struct socket *const sock,
return 0;
/* Checks for minimal header length to safely read sa_family. */
- if (addrlen < (int)offsetofend(typeof(*address), sa_family))
+ if (addrlen < (int)struct_offsetofend(address, sa_family))
return -EINVAL;
/*
@@ -382,7 +382,7 @@ static int hook_socket_connect(struct socket *const sock,
* should never be restricted.
*/
if (ret == 0 && sk_is_udp(sock->sk) &&
- addrlen >= offsetofend(typeof(*address), sa_family) &&
+ addrlen >= struct_offsetofend(address, sa_family) &&
address->sa_family != AF_UNSPEC)
ret = current_check_autobind_udp_socket(sock);
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index ed5fe746d43856..6e4f56a06aed6d 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -9656,7 +9656,7 @@ static long scarlett2_hwdep_write(struct snd_hwdep *hw,
/* Calculate the maximum permitted in data[] */
const size_t max_data_size = SCARLETT2_FLASH_RW_MAX -
- offsetof(typeof(*req), data);
+ struct_offset(req, data);
/* If erasing, wait for it to complete */
if (private->flash_write_state ==
|
| 61/3 | 2026/11/22 12:57 | llm | kmsan-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 21870 output: 211 thoughts: 1096 Thoughts: **Analyzing the Structural Refactoring Patch** Alright, let's break this down. This patch series is essentially a cosmetic cleanup, isn't it? It introduces `struct_offsetofend()` and replaces instances of the existing `offsetof` macros with these new abstractions. Specifically, we're looking at: * `offsetof(typeof(*(p)), member)` becoming `struct_offset(p, member)` * `offsetofend(typeof(*(p)), member)` becoming `struct_offsetofend(p, member)` My first instinct is to check the definitions in `include/linux/overflow.h` just to confirm my assumptions. Yep, `struct_offset` is defined as a direct alias for `offsetof`, and `struct_offsetofend` is defined the same way for its `offsetofend` counterpart. So, in essence, it's a find-and-replace operation. The patch then goes and substitutes all the instances of the old macros for the new aliases. They also added a Coccinelle script, which is a good practice for this type of sweeping change. The core question is, does this introduce any *actual* changes? I mean, beyond the code's visual structure. I'm going to run down the list of potential risks in my head: 1. **Semantic Differences:** Is there a difference in how the compiler interprets these macros? No, the macro expansions are identical, meaning no change to the generated code. It's a 1:1 replacement. 2. **Edge Cases:** Are there any obscure corner cases that the original `offsetof` calls handled that `struct_offset` might not? No, there are no special properties or hidden logic that could cause problems. 3. **Uninitialized Memory:** This is the big one, the critical KMSAN question. Are we introducing any risk of reading uninitialized memory, which is the sole focus for KMSAN that isn't already caught by KASAN or other standard tools? No. This change doesn't modify data structures, allocation, or memory initialization in any way. The preprocessed code is byte-for-byte identical. No control flow changes, no new memory, no nothing. Given that, I can confidently conclude that this is purely syntactic refactoring. I can confirm the logic: * The patch simply introduces aliases for existing macros and performs mechanical replacements. * It's purely a refactoring, with identical macro expansions and generated code. * This doesn't touch memory layout, allocation, initialization, bounds checks, or control flow, therefore eliminating any risk of uninitialized memory usage or info-leaks. Therefore, `NeedsKMSAN = false`. It's a straightforward decision. I'll prepare my reasoning now: I'll need to explain the changes, confirm that it's a syntactic refactoring with identical preprocessor expansions, and state that there's no risk of uninitialized memory, making KMSAN unnecessary. Time to call `set-results`. |
| 62/3 | 2026/11/22 12:57 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch is a pure syntactic refactoring. It introduces the helper macro `struct_offsetofend(p, member)` in `include/linux/overflow.h` (defined as `(offsetofend(typeof(*(p)), member))`) and a Coccinelle script `scripts/coccinelle/api/struct_offsetof.cocci`, then systematically replaces instances of `offsetof(typeof(*(p)), member)` with `struct_offset(p, member)` and `offsetofend(typeof(*(p)), member)` with `struct_offsetofend(p, member)`.\n\nBecause the macro expansions are identical to the original expressions, the generated machine code and runtime behavior remain entirely unchanged. No changes are made to buffer allocations, memory initialization, data copying, or control flow, and no uninitialized memory hazards or information leak risks are created. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch is a pure syntactic refactoring. It introduces the helper macro `struct_offsetofend(p, member)` in `include/linux/overflow.h` (defined as `(offsetofend(typeof(*(p)), member))`) and a Coccinelle script `scripts/coccinelle/api/struct_offsetof.cocci`, then systematically replaces instances of `offsetof(typeof(*(p)), member)` with `struct_offset(p, member)` and `offsetofend(typeof(*(p)), member)` with `struct_offsetofend(p, member)`.\n\nBecause the macro expansions are identical to the original expressions, the generated machine code and runtime behavior remain entirely unchanged. No changes are made to buffer allocations, memory initialization, data copying, or control flow, and no uninitialized memory hazards or information leak risks are created. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|