Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP5:GA
slurm.32313
U_06-Use-safe_unpack-macros.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_06-Use-safe_unpack-macros.patch of Package slurm.32313
From: Tim Wickberg <tim@schedmd.com> Date: Tue Nov 28 17:37:10 2023 -0700 Subject: [PATCH 6/28]Use safe_unpack*() macros. Patch-mainline: Upstream Git-repo: https://github.com/SchedMD/slurm Git-commit: d6c61f7d6900cc43bc6796038bbabe907a715241 References: bsc#1218046, bsc#1218050, bsc#1218051, bsc#1218053 Signed-off-by: Egbert Eich <eich@suse.de> --- src/common/pack.c | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/src/common/pack.c b/src/common/pack.c index 6fb72d8639..db3840f6b4 100644 --- a/src/common/pack.c +++ b/src/common/pack.c @@ -525,18 +525,14 @@ void pack16_array(uint16_t * valp, uint32_t size_val, Buf buffer) */ int unpack16_array(uint16_t ** valp, uint32_t * size_val, Buf buffer) { - uint32_t i = 0; - if (unpack32(size_val, buffer)) return SLURM_ERROR; if ((*size_val) > MAX_ARRAY_LEN_MEDIUM) return SLURM_ERROR; safe_xcalloc(*valp, *size_val, sizeof(uint16_t)); - for (i = 0; i < *size_val; i++) { - if (unpack16((*valp) + i, buffer)) - goto unpack_error; - } + for (uint32_t i = 0; i < *size_val; i++) + safe_unpack16(&(*valp)[i], buffer); return SLURM_SUCCESS; unpack_error: @@ -565,18 +561,14 @@ void pack32_array(uint32_t * valp, uint32_t size_val, Buf buffer) */ int unpack32_array(uint32_t ** valp, uint32_t * size_val, Buf buffer) { - uint32_t i = 0; - if (unpack32(size_val, buffer)) return SLURM_ERROR; if ((*size_val) > MAX_ARRAY_LEN_LARGE) return SLURM_ERROR; safe_xcalloc(*valp, *size_val, sizeof(uint32_t)); - for (i = 0; i < *size_val; i++) { - if (unpack32((*valp) + i, buffer)) - goto unpack_error; - } + for (uint32_t i = 0; i < *size_val; i++) + safe_unpack32(&(*valp)[i], buffer); return SLURM_SUCCESS; unpack_error: @@ -621,18 +613,14 @@ void pack64_array_as_32(uint64_t * valp, uint32_t size_val, Buf buffer) */ int unpack64_array(uint64_t ** valp, uint32_t * size_val, Buf buffer) { - uint32_t i = 0; - if (unpack32(size_val, buffer)) return SLURM_ERROR; if ((*size_val) > MAX_ARRAY_LEN_MEDIUM) return SLURM_ERROR; safe_xcalloc(*valp, *size_val, sizeof(uint64_t)); - for (i = 0; i < *size_val; i++) { - if (unpack64((*valp) + i, buffer)) - goto unpack_error; - } + for (uint32_t i = 0; i < *size_val; i++) + safe_unpack64(&(*valp)[i], buffer); return SLURM_SUCCESS; unpack_error: @@ -677,18 +665,14 @@ void packdouble_array(double *valp, uint32_t size_val, Buf buffer) int unpackdouble_array(double **valp, uint32_t* size_val, Buf buffer) { - uint32_t i = 0; - if (unpack32(size_val, buffer)) return SLURM_ERROR; if ((*size_val) > MAX_ARRAY_LEN_SMALL) return SLURM_ERROR; safe_xcalloc(*valp, *size_val, sizeof(double)); - for (i = 0; i < *size_val; i++) { - if (unpackdouble((*valp) + i, buffer)) - goto unpack_error; - } + for (uint32_t i = 0; i < *size_val; i++) + safe_unpackdouble(&(*valp)[i], buffer); return SLURM_SUCCESS; unpack_error: @@ -711,18 +695,14 @@ void packlongdouble_array(long double *valp, uint32_t size_val, Buf buffer) int unpacklongdouble_array(long double **valp, uint32_t* size_val, Buf buffer) { - uint32_t i = 0; - if (unpack32(size_val, buffer)) return SLURM_ERROR; if ((*size_val) > MAX_ARRAY_LEN_SMALL) return SLURM_ERROR; safe_xcalloc(*valp, *size_val, sizeof(long double)); - for (i = 0; i < *size_val; i++) { - if (unpacklongdouble((*valp) + i, buffer)) - goto unpack_error; - } + for (uint32_t i = 0; i < *size_val; i++) + safe_unpacklongdouble(&(*valp)[i], buffer); return SLURM_SUCCESS; unpack_error:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor