Open navid-zamani opened 8 months ago
@navid-zamani i can't reproduce this error, but i extended array to hopefully prevent this error from happening. try to renew https://github.com/gglluukk/rtl8188eus
Thank you, but the error still happened.
I narrowed down the value, and the smallest one that works is … 26
.
So this is the patch that makes it work:
diff --git a/include/wlan_bssdef.h b/include/wlan_bssdef.h
index d547b65..101fcfc 100644
--- a/include/wlan_bssdef.h
+++ b/include/wlan_bssdef.h
@@ -95,7 +95,7 @@ typedef struct _NDIS_802_11_FIXED_IEs {
typedef struct _NDIS_802_11_VARIABLE_IEs {
UCHAR ElementID;
UCHAR Length;
- UCHAR data[8];
+ UCHAR data[26];
} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
@@ -343,7 +343,7 @@ typedef struct _NDIS_802_11_FIXED_IEs {
typedef struct _NDIS_802_11_VARIABLE_IEs {
UCHAR ElementID;
UCHAR Length;
- UCHAR data[8];
+ UCHAR data[26];
} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
I am really curious what this is for, …
(and if it’s a bug that it needs to be that big here.)
in this case i set data
array length to:
UCHAR data[255];
since 255 -- maximum value of (pIE->Length)
:
https://github.com/gglluukk/rtl8188eus/blob/v5.3.9/core/rtw_wlan_util.c#L1813
UCHAR data[];
also works.
yep, under kernel you can do that, but in ANSI C you can't:
lab ~ # cat a.c
#include <stdio.h>
#define UCHAR unsigned char
int main() {
UCHAR data1[255];
UCHAR data2[];
printf("%lu %lu\n", sizeof(data1), sizeof(data2));
}
lab ~ # cc -o a a.c
a.c: In function ‘main’:
a.c:7:11: error: array size missing in ‘data2’
7 | UCHAR data2[];
| ^~~~~
lab ~ #
in case of data1[255]
i know what sizeof
is, but what is sizeof(data2[])
?
i was incorrect since data[] is "flexible array member" and not stand-alone variable, correct example:
#include <stdio.h>
#define UCHAR unsigned char
typedef struct _check1 {
UCHAR ElementID;
UCHAR Length;
UCHAR data[255];
} check1;
typedef struct _check2 {
UCHAR ElementID;
UCHAR Length;
UCHAR data[];
} check2;
int main() {
check1 c1;
check2 c2;
printf("%lu %lu\n", sizeof(c1), sizeof(c2));
}
so using data[]
might be better here hopefully to further correct memory allocations
With recent versions of the kernel (6.5.0-25 on Mint), enabling the hotspot with this driver causes the following kernel errors:
(It looks like repeated, but they all happen right away, so I thought it’s better to include them all.)
This then sometimes (the more likely the longer you use it) leads to NetworkManager using 100% CPU (on a single core), as well as all programs that use networking to completely hang, to a point where even SIGKILLing them won’t work. This prevents logging in or opening a shell to fix anything, as well as shutting down. (Alt-SysRq-REISUB works, but on Mint isn’t enabled by default.) (Hibernation also seems to be affected somehow, as it won’t wake up but boot instead. I could not find out why yet, as I had to disable the driver, as the PC is needed for work.)
It also happens with the fork by gglluukk which is a few commits ahead.
If you need any further info to reproduce it, or need me to do some diagnostics with access to the actual hardware, feel free to ask. I’m a programmer too.