[RISCV] Better run-time detection of RVV vector instruction support#1770
[RISCV] Better run-time detection of RVV vector instruction support#1770Dead2 merged 1 commit intozlib-ng:developfrom
Conversation
|
@alexsifivetw Can you tag some RISC-V users who could test or review the PR... |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1770 +/- ##
========================================
Coverage 83.02% 83.02%
========================================
Files 135 135
Lines 10310 10310
Branches 2785 2785
========================================
Hits 8560 8560
+ Misses 1057 1056 -1
- Partials 693 694 +1 ☔ View full report in Codecov by Sentry. |
Original version posted by @ncopa in zlib-ng#1705.
| if (uname(&buffer) == -1) { | ||
| // uname failed | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Only way this can fail is if the host name is too long, usually longer than 64 characters reserved for each of the fields in the struct. Even then some versions of uname function will just truncate the host name and leave NULL-termination out. However if -1 is returned, the other fields are guaranteed to be uninitialised.
Not ignoring the return value makes it clear that the call to uname and buffer in stack can't be optimised out, which would cause the contents of buffer later below to be uninitialised. Some compilers will issue warning if the contents of struct member can be uninitialised (not guaranteed to be zero-filled), but that might require enabling "higher" warning level or static analysis.
|
@mtl1979 Remember to take this out of Draft status when you feel it is ready. |
I still have one pending issue where the fix likely overlaps the same area of code... I rather combine everything to single PR so I don't have to revise this one right after... |
|
I haven't seen any activity on #1769 for two weeks now, so I'm not delaying this PR for longer... I'm not completely sure if it even is issue in zlib-ng or the way the binary itself, or C library and kernel is compiled. |
Original version posted by @ncopa in #1705.