Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
slurm
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
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: b36f0d9d9df4ecae694e551c2d0f7a06d89fcb0e 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 ccb9dcd4fa..480ad7c020 100644 --- a/src/common/pack.c +++ b/src/common/pack.c @@ -515,18 +515,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: @@ -555,18 +551,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: @@ -611,18 +603,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: @@ -667,18 +655,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: @@ -701,18 +685,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