Commit 543e45e8 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add an assert to ensure we never go into a simple stevedore with

a request for zero bytes.

Suggested by:	github::onovy
parent 0be53bce
...@@ -55,6 +55,7 @@ sml_stv_alloc(const struct stevedore *stv, size_t size) ...@@ -55,6 +55,7 @@ sml_stv_alloc(const struct stevedore *stv, size_t size)
for (;;) { for (;;) {
/* try to allocate from it */ /* try to allocate from it */
assert(size > 0);
AN(stv->sml_alloc); AN(stv->sml_alloc);
st = stv->sml_alloc(stv, size); st = stv->sml_alloc(stv, size);
if (st != NULL) if (st != NULL)
...@@ -132,6 +133,7 @@ SML_allocobj(struct worker *wrk, const struct stevedore *stv, ...@@ -132,6 +133,7 @@ SML_allocobj(struct worker *wrk, const struct stevedore *stv,
return (0); return (0);
really--; really--;
} }
AN(stv->sml_alloc);
st = stv->sml_alloc(stv, ltot); st = stv->sml_alloc(stv, ltot);
if (st != NULL && st->space < ltot) { if (st != NULL && st->space < ltot) {
stv->sml_free(st); stv->sml_free(st);
...@@ -324,7 +326,6 @@ objallocwithnuke(struct worker *wrk, const struct stevedore *stv, size_t size) ...@@ -324,7 +326,6 @@ objallocwithnuke(struct worker *wrk, const struct stevedore *stv, size_t size)
for (fail = 0; fail <= cache_param->nuke_limit; fail++) { for (fail = 0; fail <= cache_param->nuke_limit; fail++) {
/* try to allocate from it */ /* try to allocate from it */
AN(stv->sml_alloc);
st = sml_stv_alloc(stv, size); st = sml_stv_alloc(stv, size);
if (st != NULL) if (st != NULL)
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment