Re: [ovs-dev] [PATCH] ofpbuf: Prevent undefined behavior in ofpbuf_clone

2024-03-19 Thread Ilya Maximets
On 3/7/24 16:01, Ales Musil wrote: > The new_buffer data pointer is NULL when the size of the cloned > buffer is 0. This is fine as there is no need to allocate space. > However, the cloned buffer header/msg might be the same pointer > as data. This causes undefined behavior by adding 0 to NULL

Re: [ovs-dev] [PATCH] ofpbuf: Prevent undefined behavior in ofpbuf_clone

2024-03-07 Thread 0-day Robot
Bleep bloop. Greetings Ales Musil, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: WARNING: The subject summary should end with a dot. Subject: ofpbuf: Prevent undefined behavior

[ovs-dev] [PATCH] ofpbuf: Prevent undefined behavior in ofpbuf_clone

2024-03-07 Thread Ales Musil
The new_buffer data pointer is NULL when the size of the cloned buffer is 0. This is fine as there is no need to allocate space. However, the cloned buffer header/msg might be the same pointer as data. This causes undefined behavior by adding 0 to NULL pointer. Check if the data buffer is not NULL