From 69667e2c73c84b1b022a59ab9eca6f1afe987a6e Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Sun, 23 Apr 2023 10:47:02 +0800 Subject: [PATCH] iob: iob_clone_partial support Negative offset make the function can correctly handle negative offset cases Signed-off-by: zhanghongyu --- mm/iob/iob_clone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/iob/iob_clone.c b/mm/iob/iob_clone.c index 9f34221e6f..109e3d6bd8 100644 --- a/mm/iob/iob_clone.c +++ b/mm/iob/iob_clone.c @@ -140,7 +140,7 @@ int iob_clone_partial(FAR struct iob_s *iob1, unsigned int len, while (iob2 != NULL) { avail2 = CONFIG_IOB_BUFSIZE - iob2->io_offset; - if (offset2 < avail2) + if ((int)(offset2 - avail2) < 0) { break; }