Commit 0d197f20 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Greg Kroah-Hartman
Browse files

staging: rtl8723bs: Replace zero-length array with flexible-array member

One-element and zero-length arrays are deprecated and should be
replaced with flexible-array members[1].

Replace zero-length array with flexible-array member and make use
of the struct_size() helper.

[1] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/78
Link: https://github.com/KSPP/linux/issues/160


Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20210929194118.GA340431@embeddedor


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 42bdb41d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ struct rtw_cbuf {
	u32 write;
	u32 read;
	u32 size;
	void *bufs[0];
	void *bufs[];
};

bool rtw_cbuf_full(struct rtw_cbuf *cbuf);
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size)
{
	struct rtw_cbuf *cbuf;

	cbuf = rtw_malloc(sizeof(*cbuf) + sizeof(void *) * size);
	cbuf = rtw_malloc(struct_size(cbuf, bufs, size));

	if (cbuf) {
		cbuf->write = cbuf->read = 0;