Skip to content

Commit 3ecef55

Browse files
ycsinnashif
authored andcommitted
posix: shm: offset should compare with the shm size
The read/write offset should have compared with the size of the shm object, not the size of the buffer. Signed-off-by: Yong Cong Sin <[email protected]>
1 parent 3799073 commit 3ecef55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/posix/options/shm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static int shm_mmap(struct shm_obj *shm, void *addr, size_t len, int prot, int f
204204

205205
static ssize_t shm_rw(struct shm_obj *shm, void *buf, size_t size, bool is_write, size_t offset)
206206
{
207-
if (offset >= size) {
207+
if (offset >= shm->size) {
208208
size = 0;
209209
} else {
210210
size = MIN(size, shm->size - offset);

0 commit comments

Comments
 (0)