Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 1/1] vinyl: add missing diag_set in space creation
@ 2020-05-21 19:41 Vladislav Shpilevoy
  2020-05-22 17:45 ` Nikita Pettik
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Shpilevoy @ 2020-05-21 19:41 UTC (permalink / raw)
  To: tarantool-patches, korablev

vinyl_engine_create_space() didn't set an error in the
diagnostics area when region_alloc() failed. This
could lead to a crash, although was almost impossible
to happen.
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/vinyl-add-missing-diag

 src/box/vinyl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index ea4839dea..950a5508c 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -602,9 +602,11 @@ vinyl_engine_create_space(struct engine *engine, struct space_def *def,
 	struct index_def *index_def;
 	rlist_foreach_entry(index_def, key_list, link)
 		key_count++;
-	struct key_def **keys = region_alloc(&fiber()->gc,
-					     sizeof(*keys) * key_count);
+	struct key_def **keys;
+	size_t size = sizeof(*keys) * key_count;
+	keys = region_alloc(&fiber()->gc, size);
 	if (keys == NULL) {
+		diag_set(OutOfMemory, size, "region_alloc", "keys");
 		free(space);
 		return NULL;
 	}
-- 
2.21.1 (Apple Git-122.3)

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

* Re: [Tarantool-patches] [PATCH 1/1] vinyl: add missing diag_set in space creation
  2020-05-21 19:41 [Tarantool-patches] [PATCH 1/1] vinyl: add missing diag_set in space creation Vladislav Shpilevoy
@ 2020-05-22 17:45 ` Nikita Pettik
  2020-05-25 22:56   ` Vladislav Shpilevoy
  0 siblings, 1 reply; 3+ messages in thread
From: Nikita Pettik @ 2020-05-22 17:45 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On 21 May 21:41, Vladislav Shpilevoy wrote:
> vinyl_engine_create_space() didn't set an error in the
> diagnostics area when region_alloc() failed. This
> could lead to a crash, although was almost impossible
> to happen.

LGTM.

> ---
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/vinyl-add-missing-diag
> 
>  src/box/vinyl.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/box/vinyl.c b/src/box/vinyl.c
> index ea4839dea..950a5508c 100644
> --- a/src/box/vinyl.c
> +++ b/src/box/vinyl.c
> @@ -602,9 +602,11 @@ vinyl_engine_create_space(struct engine *engine, struct space_def *def,
>  	struct index_def *index_def;
>  	rlist_foreach_entry(index_def, key_list, link)
>  		key_count++;
> -	struct key_def **keys = region_alloc(&fiber()->gc,
> -					     sizeof(*keys) * key_count);
> +	struct key_def **keys;
> +	size_t size = sizeof(*keys) * key_count;
> +	keys = region_alloc(&fiber()->gc, size);
>  	if (keys == NULL) {
> +		diag_set(OutOfMemory, size, "region_alloc", "keys");
>  		free(space);
>  		return NULL;
>  	}
> -- 
> 2.21.1 (Apple Git-122.3)
> 

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

* Re: [Tarantool-patches] [PATCH 1/1] vinyl: add missing diag_set in space creation
  2020-05-22 17:45 ` Nikita Pettik
@ 2020-05-25 22:56   ` Vladislav Shpilevoy
  0 siblings, 0 replies; 3+ messages in thread
From: Vladislav Shpilevoy @ 2020-05-25 22:56 UTC (permalink / raw)
  To: Nikita Pettik; +Cc: tarantool-patches

Pushed to master, 2.4, 2.3, 1.10.

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

end of thread, other threads:[~2020-05-25 22:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 19:41 [Tarantool-patches] [PATCH 1/1] vinyl: add missing diag_set in space creation Vladislav Shpilevoy
2020-05-22 17:45 ` Nikita Pettik
2020-05-25 22:56   ` Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox