Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570945

Re: [PATCHv3 5/7] tap: Extending tap device create/destroy APIs

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCHv3 5/7] tap: Extending tap device create/destroy APIs
Date 2017-01-31 19:00 +0100
Message-ID <t5KSJ-3Cb-3@gated-at.bofh.it> (permalink)
References <t5pEB-7OD-1@gated-at.bofh.it> <t5pEB-7OD-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Sainath Grandhi <sainath.grandhi@intel.com>
Date: Mon, 30 Jan 2017 11:12:00 -0800

> +	list_for_each_entry_safe(tap_major, tmp, &major_list, next) {
> +		if (tap_major->major == major) {
> +			return tap_major;
> +		}
> +	}

Single line basic blocks, such as this 'if' statement, should not be
surrounded by curly braces.

Also I see not mutual exclusion being implemented to protect this
list.  If there is, it is not obvious, so it should be documented with
a comment explaining what protects the list.

> @@ -1175,14 +1228,7 @@ int tap_create_cdev(struct cdev *tap_cdev,
>  	if (err)
>  		goto out2;
>  
> -	macvtap_major.major = MAJOR(*tap_major);
> -
> -	idr_init(&macvtap_major.minor_idr);
> -	mutex_init(&macvtap_major.minor_lock);
> -
> -	macvtap_major.device_name = device_name;
> -
> -	return err;
> +	return tap_list_add(*tap_major, device_name);
>  
>  out2:
>  	unregister_chrdev_region(*tap_major, TAP_NUM_DEVS);

If tap_list_add() fails, you will leave the chrdev region registered.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv3 0/7] Refactor macvtap to re-use tap functionality by other virtual intefaces Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100
  [PATCHv3 5/7] tap: Extending tap device create/destroy APIs Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100
    Re: [PATCHv3 5/7] tap: Extending tap device create/destroy APIs David Miller <davem@davemloft.net> - 2017-01-31 19:00 +0100
      RE: [PATCHv3 5/7] tap: Extending tap device create/destroy APIs "Grandhi, Sainath" <sainath.grandhi@intel.com> - 2017-02-03 00:30 +0100
  [PATCHv3 1/7] tap: Refactoring macvtap.c Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100
  [PATCHv3 3/7] tap: Tap character device creation/destroy API Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100
  [PATCHv3 6/7] tap: tap as an independent module Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100
  [PATCHv3 4/7] tap: Abstract type of virtual interface from tap  implementation Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100
  [PATCHv3 2/7] tap: Renaming tap related APIs, data structures, macros Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100
  [PATCHv3 7/7] ipvtap: IP-VLAN based tap driver Sainath Grandhi <sainath.grandhi@intel.com> - 2017-01-30 20:20 +0100

csiph-web