-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/40435/#review108773
-----------------------------------------------------------

Ship it!


Could you also create a clean-up patch to get rid of the unnecessary `struct` 
disambiguators in this file?


3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp (lines 214 - 229)
<https://reviews.apache.org/r/40435/#comment168229>

    Great comment!
    
    Could you wrap some of the code segments in there in backquotes?



3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp (lines 230 - 233)
<https://reviews.apache.org/r/40435/#comment168230>

    We should use `auto` here, since we already specify the type on the right.
    
    ```cpp
      const auto* addr = reinterpret_cast<const sockaddr*>(&_storage);
      return create(*addr);
    ```



3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp (lines 241 - 244)
<https://reviews.apache.org/r/40435/#comment168231>

    `auto` here as well:
    
    ```cpp
      const auto* addr = reinterpret_cast<const sockaddr_in*>(&_storage);
      return IP(addr->sin_addr);
    ```



3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp (lines 247 - 249)
<https://reviews.apache.org/r/40435/#comment168232>

    Not yours, but this fits in one line.


- Michael Park


On Dec. 3, 2015, 1:45 a.m., Neil Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/40435/
> -----------------------------------------------------------
> 
> (Updated Dec. 3, 2015, 1:45 a.m.)
> 
> 
> Review request for mesos, Benjamin Bannier, Ben Mahler, Joris Van Remoortere, 
> Michael Park, and Niklas Nielsen.
> 
> 
> Bugs: MESOS-3939
>     https://issues.apache.org/jira/browse/MESOS-3939
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> The previous code took the address of a "struct sockaddr", and then cast the
> resulting pointer to "struct sockaddr_storage *". The alignment requirements 
> for
> "struct sockaddr_storage *" are more strict than for "struct sockaddr *", and
> hence this code produced undefined behavior per ubsan in GCC 5.2.
> 
> Along the way, tweak the code to use reinterpret_cast rather than a C-style
> cast, and not to unnecessarily cast-away constness.
> 
> MESOS-3939.
> 
> 
> Diffs
> -----
> 
>   3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp 
> 3e506e1e94ee32e3a19870e1fd72d9968c5f8e67 
> 
> Diff: https://reviews.apache.org/r/40435/diff/
> 
> 
> Testing
> -------
> 
> "make check" on Linux/AMD64 + GCC 5.2 + ubsan; without fix, ubsan reports an 
> error. With fix, ubsan does not report (this) error.
> 
> 
> Thanks,
> 
> Neil Conway
> 
>

Reply via email to