diff mbox series

[ovs-dev,10/11] lib: Fix possible null pointer to execvp.

Message ID 1509211918-14829-11-git-send-email-u9012063@gmail.com
State Changes Requested
Headers show
Series Fix clang static analysis null pointer bugs. | expand

Commit Message

William Tu Oct. 28, 2017, 5:31 p.m. UTC
Clang reports possible null pointer 'argv[0]' to execvp.
Fix it by adding ovs_assert check.

Signed-off-by: William Tu <u9012063@gmail.com>
---
 lib/process.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Michelson Oct. 30, 2017, 3:25 p.m. UTC | #1
This looks fine to me.
If you end up needing to re-work this patch series, I think it would be
appropriate to combine this with patch #4 since this is essentially fixing
the same possible NULL pointer.

On Sat, Oct 28, 2017 at 12:38 PM William Tu <u9012063@gmail.com> wrote:

> Clang reports possible null pointer 'argv[0]' to execvp.
> Fix it by adding ovs_assert check.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
>
Acked-by: Mark Michelson <mmichels@redhat.com>

> ---
>  lib/process.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/process.c b/lib/process.c
> index 254052f2c27d..0b8f994f9b75 100644
> --- a/lib/process.c
> +++ b/lib/process.c
> @@ -275,6 +275,7 @@ process_start(char **argv, struct process **pp)
>              close(fd);
>          }
>          xpthread_sigmask(SIG_SETMASK, &prev_mask, NULL);
> +        ovs_assert(argv[0]);
>          execvp(argv[0], argv);
>          fprintf(stderr, "execvp(\"%s\") failed: %s\n",
>                  argv[0], ovs_strerror(errno));
> --
> 2.7.4
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/lib/process.c b/lib/process.c
index 254052f2c27d..0b8f994f9b75 100644
--- a/lib/process.c
+++ b/lib/process.c
@@ -275,6 +275,7 @@  process_start(char **argv, struct process **pp)
             close(fd);
         }
         xpthread_sigmask(SIG_SETMASK, &prev_mask, NULL);
+        ovs_assert(argv[0]);
         execvp(argv[0], argv);
         fprintf(stderr, "execvp(\"%s\") failed: %s\n",
                 argv[0], ovs_strerror(errno));