Subject: Re: [iproute PATCH v2 5/5] tipc/bearer: Prevent NULL pointer dereference

From: Stephen Hemminger <[email-masked]>
Date: Fri, 18 Aug 2017 09:24:22 -0700

On Thu, 17 Aug 2017 19:09:31 +0200
Phil Sutter <[email-masked]> wrote:

> -	opt = get_opt(opts, "media");
> -	if (strcmp(opt->val, "udp") == 0) {
> +	if ((opt = get_opt(opts, "media")) &&
> +	    strcmp(opt->val, "udp") == 0) {

Please don't merge assignment and comparison unless necessary for other reasons.

	opt = get_opt(opts, "media");
	if (opt && strcmp(opt->val, "udp") == 0) {