I sent a patch for review. There is actually another warning present
only on branch-2.3.

On Thu, Jul 3, 2014 at 11:06 PM, Lori Jakab <loja...@cisco.com> wrote:
> On 7/4/14, 12:51 AM, Ansis Atteka wrote:
>>
>> On Thu, Jul 3, 2014 at 12:57 PM, Ben Pfaff <b...@nicira.com> wrote:
>>>
>>> On Sat, Jun 28, 2014 at 02:03:15PM -0700, Ansis Atteka wrote:
>>>>
>>>> From: Ansis <ansisatt...@gmail.com>
>>>>
>>>> Commit 8a9562 ("dpif-netdev: Add DPDK netdev.") reversed sequence
>>>> in which set_program_name() and proctitle_init() functions are
>>>> called.  This introduced a regression where program_name and argv_start
>>>> would point to exactly the same memory (previously both of these
>>>> pointers were pointing to different memory locations because
>>>> proctitle_init() would have beforehand created a copy of argv[0]
>>>> for the set_program_name() call).
>>>>
>>>> This regression on my system caused ovs-vswitchd monitoring process to
>>>> show up without process name:
>>>>
>>>> ...  00:00:00 : monitoring pid 26308 (healthy)
>>>>
>>>> Ps output was lacking process name because following code was
>>>> using overlapping memory for source and target buffer:.
>>>>
>>>> proctitle_set(const char *format, ...)
>>>> {
>>>>      ...
>>>>      n = snprintf(argv_start, argv_size, "%s: ", program_name);
>>>>
>>>> Overall C99 and POSIX standards state that behavior is undefined
>>>> if source and target buffers overlap.
>>>>
>>>> Signed-off-by: Ansis Atteka <aatt...@nicira.com>
>>>
>>> I like this regardless of the bug fix because it makes behavior more
>>> consistent on Windows and Unix (program_name is now malloc'd in both
>>> cases).
>>>
>>> I would remove the 'if (program_name)' test around the free call,
>>> since free(NULL) is a no-op anyway.
>>>
>>> Acked-by: Ben Pfaff <b...@nicira.com>
>>
>> Thanks. I removed the "if" statement and pushed this to master and
>> branch-2.3.
>
>
> It looks like with removing the "if" statement the free() call was moved out
> of the "#ifdef _WIN32" section, which causes a warning (and the build to
> fail when I have --enable-Werror) on Linux, with both Clang 3.4.2 and GCC
> 4.8.3.
>
> -Lori
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to