linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs-tools: fixed incorrect error handling
@ 2023-11-20  6:55 Maxim Korotkov
  2023-11-20  7:55 ` [f2fs-dev] [PATCH v2] " Maxim Korotkov
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Korotkov @ 2023-11-20  6:55 UTC (permalink / raw)
  To: Aravind Ramesh; +Cc: Jaegeuk Kim, Maxim Korotkov, linux-f2fs-devel

diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
index 56c97d1..81088af 100644
--- a/lib/libf2fs_zoned.c
+++ b/lib/libf2fs_zoned.c
@@ -293,6 +293,7 @@ int f2fs_check_zones(int j)
 
 	dev->zone_cap_blocks = malloc(dev->nr_zones * sizeof(size_t));
 	if (!dev->zone_cap_blocks) {
+		free(rep);
 		ERR_MSG("No memory for zone capacity list.\n");
 		return -ENOMEM;
 	}
-- 
2.34.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [f2fs-dev] [PATCH v2] f2fs-tools: fixed incorrect error handling
  2023-11-20  6:55 [f2fs-dev] [PATCH] f2fs-tools: fixed incorrect error handling Maxim Korotkov
@ 2023-11-20  7:55 ` Maxim Korotkov
  2023-11-28  6:24   ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Korotkov @ 2023-11-20  7:55 UTC (permalink / raw)
  To: Aravind Ramesh
  Cc: Jaegeuk Kim, Maxim Korotkov, Maxim Korotkov, linux-f2fs-devel

Case of failed memory allocation of dev->zone_cap_blocks
doesn't release heap allocated rep
Found by RASU JSC
Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support)
Signed-off-by: Maxim Korotkov <maskorotkov@rasu.ru>
---
changeset:
 - editted description
 lib/libf2fs_zoned.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
index 56c97d1..81088af 100644
--- a/lib/libf2fs_zoned.c
+++ b/lib/libf2fs_zoned.c
@@ -293,6 +293,7 @@ int f2fs_check_zones(int j)
 
 	dev->zone_cap_blocks = malloc(dev->nr_zones * sizeof(size_t));
 	if (!dev->zone_cap_blocks) {
+		free(rep);
 		ERR_MSG("No memory for zone capacity list.\n");
 		return -ENOMEM;
 	}
-- 
2.34.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH v2] f2fs-tools: fixed incorrect error handling
  2023-11-20  7:55 ` [f2fs-dev] [PATCH v2] " Maxim Korotkov
@ 2023-11-28  6:24   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2023-11-28  6:24 UTC (permalink / raw)
  To: Maxim Korotkov, Aravind Ramesh
  Cc: Jaegeuk Kim, Maxim Korotkov, linux-f2fs-devel

On 2023/11/20 15:55, Maxim Korotkov wrote:
> Case of failed memory allocation of dev->zone_cap_blocks
> doesn't release heap allocated rep
> Found by RASU JSC
> Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support)
> Signed-off-by: Maxim Korotkov <maskorotkov@rasu.ru>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-28  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20  6:55 [f2fs-dev] [PATCH] f2fs-tools: fixed incorrect error handling Maxim Korotkov
2023-11-20  7:55 ` [f2fs-dev] [PATCH v2] " Maxim Korotkov
2023-11-28  6:24   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).