[libvirt] [PATCH 2/3] networkBandwidthGenericChecks: Drop useless check

John Ferlan jferlan at redhat.com
Wed Aug 12 11:03:19 UTC 2015



On 08/12/2015 05:13 AM, Michal Privoznik wrote:
> There's a check right at the beginning of the function that
> shortcuts if the function was called over all NULL arguments.
> However, this was meant just as a fool-proof check so that we
> don't crash if function is used in a bad manner. Anyway, it makes
> Coverity unhappy as it then thinks any of the arguments could be
> NULL. Well, with the current state of the code it can't.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/network/bridge_driver.c | 3 ---
>  1 file changed, 3 deletions(-)
> 

ACK - it was something I pointed out in my review though ;-)
(http://www.redhat.com/archives/libvir-list/2015-August/msg00374.html).

Hence why I pointed out to use ATTRIBUTE_NONNULL for both args

John
> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index f57c400..c343e5b 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -4960,9 +4960,6 @@ networkBandwidthGenericChecks(virDomainNetDefPtr iface,
>      virNetDevBandwidthPtr ifaceBand;
>      unsigned long long old_floor, new_floor;
>  
> -    if (!iface && !newBandwidth)
> -        return false;
> -
>      if (virDomainNetGetActualType(iface) != VIR_DOMAIN_NET_TYPE_NETWORK) {
>          /* This is not an interface that's plugged into a network.
>           * We don't care. Thus from our POV bandwidth change is allowed. */
> 




More information about the libvir-list mailing list