Re: [PATCH] Fix a potentially uninitialised variable in SELinux hooks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Moore <paul.moore@xxxxxx> wrote:

> 	ret = selinux_parse_skb_ipv4(...);
> 	if (ret != 0)
> 		addrp = (src ? ...);
> 	else
> 		addrp = NULL;

I guess you mean "*addrp = ..." in that case, otherwise you haven't eliminated
anything.

Personally, I prefer to add extra variables if it makes things clearer, and I
prefer to use gotos for error handling.  It eliminates the else-statements that
you would otherwise introduce, and the goto-label can be used as documentation
of a sort too.  Furthermore, it moves the error handling clearly out of the
main route through the function.  Having said that, I should reorder my patch
to put the parse_error segment last - then I can ditch the okay label and use
break instead of goto.

It comes down to personal preference, I guess.

David

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.

[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux