diff options
| author | Rosen Penev <rosenp@gmail.com> | 2026-03-12 07:59:21 +0300 |
|---|---|---|
| committer | Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> | 2026-03-17 13:04:47 +0300 |
| commit | 37a23d6f11938cd59927e3307b9b301624df8e8f (patch) | |
| tree | f1868b625d2fc8ed1e16e3a5805f2378f66fd184 /include | |
| parent | f227b246307e0cf3091e13e7fbae3974aaf38eb9 (diff) | |
| download | linux-37a23d6f11938cd59927e3307b9b301624df8e8f.tar.xz | |
bus: mhi: host: Use kzalloc_flex
Change kzalloc + kzalloc to just kzalloc with a flexible array member.
Add __counted_by for extra runtime analysis when requested.
Move counting assignment immediately after allocation as required by
__counted_by.
Move mhi_buf definition as a complete definition as needed for flex
arrays. It's not a pointer anymore.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
[mani: squashed https://lore.kernel.org/mhi/20260317-mhi-invalid-free-mhi-buffers-v1-1-8418a3ad604f@oss.qualcomm.com]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260312045921.7663-1-rosenp@gmail.com
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/mhi.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 88ccb3e14f48..fb3ba639f4f8 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -86,16 +86,32 @@ enum mhi_ch_type { }; /** + * struct mhi_buf - MHI Buffer description + * @buf: Virtual address of the buffer + * @name: Buffer label. For offload channel, configurations name must be: + * ECA - Event context array data + * CCA - Channel context array data + * @dma_addr: IOMMU address of the buffer + * @len: # of bytes + */ +struct mhi_buf { + void *buf; + const char *name; + dma_addr_t dma_addr; + size_t len; +}; + +/** * struct image_info - Firmware and RDDM table * @mhi_buf: Buffer for firmware and RDDM table * @entries: # of entries in table */ struct image_info { - struct mhi_buf *mhi_buf; /* private: from internal.h */ struct bhi_vec_entry *bhi_vec; /* public: */ u32 entries; + struct mhi_buf mhi_buf[] __counted_by(entries); }; /** @@ -489,22 +505,6 @@ struct mhi_result { }; /** - * struct mhi_buf - MHI Buffer description - * @buf: Virtual address of the buffer - * @name: Buffer label. For offload channel, configurations name must be: - * ECA - Event context array data - * CCA - Channel context array data - * @dma_addr: IOMMU address of the buffer - * @len: # of bytes - */ -struct mhi_buf { - void *buf; - const char *name; - dma_addr_t dma_addr; - size_t len; -}; - -/** * struct mhi_driver - Structure representing a MHI client driver * @probe: CB function for client driver probe function * @remove: CB function for client driver remove function |
