mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
hk: use 0 pointer for 0-sized buffers
allows eliding bounds checks Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
parent
675b876b8c
commit
802c30beab
1 changed files with 5 additions and 1 deletions
|
|
@ -35,7 +35,11 @@ static inline struct hk_addr_range
|
|||
hk_buffer_addr_range(const struct hk_buffer *buffer, uint64_t offset,
|
||||
uint64_t range)
|
||||
{
|
||||
if (buffer == NULL)
|
||||
/* If range == 0, return a NULL pointer. Thanks to soft fault, that allows
|
||||
* eliding robustness2 bounds checks for index = 0, as the bottom of VA space
|
||||
* is reserved.
|
||||
*/
|
||||
if (buffer == NULL || range == 0)
|
||||
return (struct hk_addr_range){.range = 0};
|
||||
|
||||
return (struct hk_addr_range){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue