Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Timur Safin" <tsafin@tarantool.org>
To: 'Vladislav Shpilevoy' <v.shpilevoy@tarantool.org>,
	'Aleksandr Lyapunov' <alyapunov@tarantool.org>,
	tarantool-patches@dev.tarantool.org, gorcunov@gmail.com
Subject: Re: [Tarantool-patches] [PATCH 2/2] uuid: fix unaligned memory access
Date: Thu, 21 May 2020 17:37:17 +0300	[thread overview]
Message-ID: <402001d62f7d$54311a90$fc934fb0$@tarantool.org> (raw)
In-Reply-To: <c1062358-5950-0e31-a729-7d813aa214ac@tarantool.org>

LGTM

: -----Original Message-----
: From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
: Sent: Wednesday, May 20, 2020 12:25 AM
: To: Aleksandr Lyapunov <alyapunov@tarantool.org>; tarantool-
: patches@dev.tarantool.org; tsafin@tarantool.org; gorcunov@gmail.com
: Subject: Re: [PATCH 2/2] uuid: fix unaligned memory access
: 
: ====================
: diff --git a/src/lib/uuid/tt_uuid.h b/src/lib/uuid/tt_uuid.h
: index d62991c65..70c3b98b1 100644
: --- a/src/lib/uuid/tt_uuid.h
: +++ b/src/lib/uuid/tt_uuid.h
: @@ -149,19 +149,6 @@ tt_uuid_bswap(struct tt_uuid *uu)
:  	uu->time_hi_and_version = bswap_u16(uu->time_hi_and_version);
:  }
: 
: -/**
: - * \brief Test that uuid is nil
: - * \param uu UUID
: - * \retval true if all members of \a uu 0
: - * \retval false otherwise
: - */
: -inline bool
: -tt_uuid_is_nil(const struct tt_uuid *uu)
: -{
: -	const uint32_t *p = (const uint32_t *) uu;
: -	return p[0] == 0 && p[1] == 0 && p[2] == 0 && p[3] == 0;
: -}
: -
:  /**
:   * \brief Test that \a lhs equal \a rhs
:   * \param lhs UUID
: @@ -172,14 +159,23 @@ tt_uuid_is_nil(const struct tt_uuid *uu)
:  inline bool
:  tt_uuid_is_equal(const struct tt_uuid *lhs, const struct tt_uuid *rhs)
:  {
: -	const uint32_t *lp = (const uint32_t *) lhs;
: -	const uint32_t *rp = (const uint32_t *) rhs;
: -	return lp[0] == rp[0] && lp[1] == rp[1] && lp[2] == rp[2] &&
: -	       lp[3] == rp[3];
: +	return memcmp(lhs, rhs, sizeof(*lhs)) == 0;
:  }
: 
:  extern const struct tt_uuid uuid_nil;
: 
: +/**
: + * \brief Test that uuid is nil.
: + * \param uu UUID.
: + * \retval true If all members of \a uu 0.
: + * \retval false Otherwise.
: + */
: +inline bool
: +tt_uuid_is_nil(const struct tt_uuid *uu)
: +{
: +	return tt_uuid_is_equal(uu, &uuid_nil);
: +}
: +
:  char *
:  tt_uuid_str(const struct tt_uuid *uu);
: 

  parent reply	other threads:[~2020-05-21 14:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 23:03 [Tarantool-patches] [PATCH 0/2] Sanitize uuid and bit alignment Vladislav Shpilevoy
2020-05-15 23:03 ` [Tarantool-patches] [PATCH 1/2] bit: fix unaligned memory access and UB bit shift Vladislav Shpilevoy
2020-05-21 14:37   ` Timur Safin
2020-05-15 23:03 ` [Tarantool-patches] [PATCH 2/2] uuid: fix unaligned memory access Vladislav Shpilevoy
2020-05-18 12:55   ` Aleksandr Lyapunov
2020-05-18 21:17     ` Vladislav Shpilevoy
2020-05-19  7:28       ` Aleksandr Lyapunov
2020-05-19  8:34         ` Timur Safin
2020-05-19 21:24         ` Vladislav Shpilevoy
2020-05-20  8:18           ` Aleksandr Lyapunov
2020-05-20 21:38             ` Vladislav Shpilevoy
2020-05-21  8:28               ` Aleksandr Lyapunov
2020-05-21 14:37           ` Timur Safin [this message]
2020-05-21 19:33 ` [Tarantool-patches] [PATCH 0/2] Sanitize uuid and bit alignment Vladislav Shpilevoy

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='402001d62f7d$54311a90$fc934fb0$@tarantool.org' \
    --to=tsafin@tarantool.org \
    --cc=alyapunov@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/2] uuid: fix unaligned memory access' \
    /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