Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, korablev@tarantool.org
Subject: [Tarantool-patches] [PATCH 1/1] fk: fix wrong sizeof() in fk_constraint_def_sizeof()
Date: Thu, 28 May 2020 01:25:41 +0200	[thread overview]
Message-ID: <e5d37cd5cb5c73992ba15d4de15f2eeddffbe3ed.1590621912.git.v.shpilevoy@tarantool.org> (raw)

The function returns a number of bytes needed to store
an fk_constraint_def object with its name and links.
However it used sizeof(struct fk_constraint) instead
of sizeof(struct fk_constraint_def) to calculate
base object size. This worked only because
fk_constraint is bigger than fk_constraint_def.
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/fk_constraint_sizeof

 src/box/fk_constraint.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/fk_constraint.h b/src/box/fk_constraint.h
index fee82afb0..b1e0cfb84 100644
--- a/src/box/fk_constraint.h
+++ b/src/box/fk_constraint.h
@@ -131,7 +131,7 @@ struct fk_constraint {
 static inline size_t
 fk_constraint_def_sizeof(uint32_t link_count, uint32_t name_len)
 {
-	return sizeof(struct fk_constraint) +
+	return sizeof(struct fk_constraint_def) +
 		link_count * sizeof(struct field_link) +
 		name_len + 1;
 }
-- 
2.21.1 (Apple Git-122.3)

             reply	other threads:[~2020-05-27 23:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 23:25 Vladislav Shpilevoy [this message]
2020-05-28  7:24 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5d37cd5cb5c73992ba15d4de15f2eeddffbe3ed.1590621912.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/1] fk: fix wrong sizeof() in fk_constraint_def_sizeof()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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