Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc

2017-05-19 Thread Shashank Ram




From: ovs-dev-boun...@openvswitch.org  on 
behalf of Alin Serdean 
Sent: Friday, May 19, 2017 4:28 PM
To: Ben Pfaff
Cc: ovs dev; Guru Shetty
Subject: Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc


> -Original Message-
> From: Ben Pfaff [mailto:b...@ovn.org]
> Sent: Saturday, May 20, 2017 2:25 AM
> To: Alin Serdean 
> Cc: Guru Shetty ; ovs dev 
> Subject: Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc
>
> OK, I backported all the way to branch-2.5, dropping the wmi changes in
> 2.6 and 2.5.
>
[Alin Serdean] Thanks!

Thanks Ben!
___
dev mailing list
d...@openvswitch.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=6OuVHk-mnufSWzkKa74UkQ&m=DSRLafbCyMsR22NckE4P-Vq0bEplB1nkNc4kK_tzC08&s=Pjzxd7hYiN3_gR6Tymyjf_X9OabkpxwuxD1pNMYBJjg&e=
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc

2017-05-19 Thread Alin Serdean

> -Original Message-
> From: Ben Pfaff [mailto:b...@ovn.org]
> Sent: Saturday, May 20, 2017 2:25 AM
> To: Alin Serdean 
> Cc: Guru Shetty ; ovs dev 
> Subject: Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc
> 
> OK, I backported all the way to branch-2.5, dropping the wmi changes in
> 2.6 and 2.5.
> 
[Alin Serdean] Thanks!
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc

2017-05-19 Thread Ben Pfaff
OK, I backported all the way to branch-2.5, dropping the wmi changes in
2.6 and 2.5.

On Fri, May 19, 2017 at 10:56:33PM +, Alin Serdean wrote:
> Branch-2.7 at least please. Branch-2.6 and branch-2.5 does not have the wmi.c 
> file
> 
> > -Original Message-
> > From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> > boun...@openvswitch.org] On Behalf Of Ben Pfaff
> > Sent: Saturday, May 20, 2017 1:52 AM
> > To: Guru Shetty 
> > Cc: ovs dev 
> > Subject: Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc
> > 
> > On Fri, May 19, 2017 at 03:20:41PM -0700, Guru Shetty wrote:
> > > On 19 May 2017 at 14:59, Shashank Ram  wrote:
> > >
> > > > xmalloc checks if the size is valid before allocating memory, and
> > > > also if the allocation was successful.
> > > >
> > > > Signed-off-by: Shashank Ram 
> > > >
> > > Applied, thanks!
> > 
> > Does this need any backporting?
> > ___
> > dev mailing list
> > d...@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc

2017-05-19 Thread Alin Serdean
Branch-2.7 at least please. Branch-2.6 and branch-2.5 does not have the wmi.c 
file

> -Original Message-
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of Ben Pfaff
> Sent: Saturday, May 20, 2017 1:52 AM
> To: Guru Shetty 
> Cc: ovs dev 
> Subject: Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc
> 
> On Fri, May 19, 2017 at 03:20:41PM -0700, Guru Shetty wrote:
> > On 19 May 2017 at 14:59, Shashank Ram  wrote:
> >
> > > xmalloc checks if the size is valid before allocating memory, and
> > > also if the allocation was successful.
> > >
> > > Signed-off-by: Shashank Ram 
> > >
> > Applied, thanks!
> 
> Does this need any backporting?
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc

2017-05-19 Thread Ben Pfaff
On Fri, May 19, 2017 at 03:20:41PM -0700, Guru Shetty wrote:
> On 19 May 2017 at 14:59, Shashank Ram  wrote:
> 
> > xmalloc checks if the size is valid before allocating
> > memory, and also if the allocation was successful.
> >
> > Signed-off-by: Shashank Ram 
> >
> Applied, thanks!

Does this need any backporting?
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc

2017-05-19 Thread Guru Shetty
On 19 May 2017 at 14:59, Shashank Ram  wrote:

> xmalloc checks if the size is valid before allocating
> memory, and also if the allocation was successful.
>
> Signed-off-by: Shashank Ram 
>
Applied, thanks!


> ---
>  lib/netdev-windows.c | 14 ++
>  lib/wmi.c| 14 ++
>  2 files changed, 4 insertions(+), 24 deletions(-)
>
> diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c
> index 375cb32..f90a439 100644
> --- a/lib/netdev-windows.c
> +++ b/lib/netdev-windows.c
> @@ -394,12 +394,7 @@ netdev_windows_arp_lookup(const struct netdev
> *netdev,
>  return ENXIO;
>  }
>
> -arp_table = (MIB_IPNETTABLE *) malloc(buffer_length);
> -
> -if (arp_table == NULL) {
> -VLOG_ERR("Could not allocate memory for all the interfaces");
> -return ENXIO;
> -}
> +arp_table = (MIB_IPNETTABLE *) xmalloc(buffer_length);
>
>  ret_val = GetIpNetTable(arp_table, &buffer_length, false);
>
> @@ -443,12 +438,7 @@ netdev_windows_get_next_hop(const struct in_addr
> *host,
>  return ENXIO;
>  }
>
> -all_addr = (IP_ADAPTER_ADDRESSES *) malloc(buffer_length);
> -
> -if (all_addr == NULL) {
> -VLOG_ERR("Could not allocate memory for all the interfaces");
> -return ENXIO;
> -}
> +all_addr = (IP_ADAPTER_ADDRESSES *) xmalloc(buffer_length);
>
>  ret_val = GetAdaptersAddresses(AF_INET,
> GAA_FLAG_INCLUDE_PREFIX |
> diff --git a/lib/wmi.c b/lib/wmi.c
> index dba8022..e6dc63c 100644
> --- a/lib/wmi.c
> +++ b/lib/wmi.c
> @@ -406,12 +406,7 @@ delete_wmi_port(char *name)
>  wchar_t internal_port_query[WMI_QUERY_COUNT] = L"SELECT * from "
>  L"Msvm_EthernetPortAllocationSettingData  WHERE ElementName =
> \"" ;
>
> -wide_name = malloc((strlen(name) + 1) * sizeof(wchar_t));
> -if (wide_name == NULL) {
> -VLOG_WARN("Could not allocate memory for wide string");
> -retval = false;
> -goto error;
> -}
> +wide_name = xmalloc((strlen(name) + 1) * sizeof(wchar_t));
>
>  if (!tranform_wide(name, wide_name)) {
>  retval = false;
> @@ -693,12 +688,7 @@ create_wmi_port(char *name) {
>  wchar_t internal_port_query[WMI_QUERY_COUNT] = L"SELECT * FROM "
>  L"Msvm_InternalEthernetPort WHERE ElementName = \"";
>
> -wide_name = malloc((strlen(name) + 1) * sizeof(wchar_t));
> -if (wide_name == NULL) {
> -VLOG_WARN("Could not allocate memory for wide string");
> -retval = false;
> -goto error;
> -}
> +wide_name = xmalloc((strlen(name) + 1) * sizeof(wchar_t));
>
>  if (!tranform_wide(name, wide_name)) {
>  retval = false;
> --
> 2.9.3.windows.2
>
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] Windows lib: Use xmalloc instead of malloc

2017-05-19 Thread Shashank Ram
xmalloc checks if the size is valid before allocating
memory, and also if the allocation was successful.

Signed-off-by: Shashank Ram 
---
 lib/netdev-windows.c | 14 ++
 lib/wmi.c| 14 ++
 2 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c
index 375cb32..f90a439 100644
--- a/lib/netdev-windows.c
+++ b/lib/netdev-windows.c
@@ -394,12 +394,7 @@ netdev_windows_arp_lookup(const struct netdev *netdev,
 return ENXIO;
 }

-arp_table = (MIB_IPNETTABLE *) malloc(buffer_length);
-
-if (arp_table == NULL) {
-VLOG_ERR("Could not allocate memory for all the interfaces");
-return ENXIO;
-}
+arp_table = (MIB_IPNETTABLE *) xmalloc(buffer_length);

 ret_val = GetIpNetTable(arp_table, &buffer_length, false);

@@ -443,12 +438,7 @@ netdev_windows_get_next_hop(const struct in_addr *host,
 return ENXIO;
 }

-all_addr = (IP_ADAPTER_ADDRESSES *) malloc(buffer_length);
-
-if (all_addr == NULL) {
-VLOG_ERR("Could not allocate memory for all the interfaces");
-return ENXIO;
-}
+all_addr = (IP_ADAPTER_ADDRESSES *) xmalloc(buffer_length);

 ret_val = GetAdaptersAddresses(AF_INET,
GAA_FLAG_INCLUDE_PREFIX |
diff --git a/lib/wmi.c b/lib/wmi.c
index dba8022..e6dc63c 100644
--- a/lib/wmi.c
+++ b/lib/wmi.c
@@ -406,12 +406,7 @@ delete_wmi_port(char *name)
 wchar_t internal_port_query[WMI_QUERY_COUNT] = L"SELECT * from "
 L"Msvm_EthernetPortAllocationSettingData  WHERE ElementName = \"" ;

-wide_name = malloc((strlen(name) + 1) * sizeof(wchar_t));
-if (wide_name == NULL) {
-VLOG_WARN("Could not allocate memory for wide string");
-retval = false;
-goto error;
-}
+wide_name = xmalloc((strlen(name) + 1) * sizeof(wchar_t));

 if (!tranform_wide(name, wide_name)) {
 retval = false;
@@ -693,12 +688,7 @@ create_wmi_port(char *name) {
 wchar_t internal_port_query[WMI_QUERY_COUNT] = L"SELECT * FROM "
 L"Msvm_InternalEthernetPort WHERE ElementName = \"";

-wide_name = malloc((strlen(name) + 1) * sizeof(wchar_t));
-if (wide_name == NULL) {
-VLOG_WARN("Could not allocate memory for wide string");
-retval = false;
-goto error;
-}
+wide_name = xmalloc((strlen(name) + 1) * sizeof(wchar_t));

 if (!tranform_wide(name, wide_name)) {
 retval = false;
--
2.9.3.windows.2

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev