Search Linux Wireless

Re: Re: [PATCH] iw: Static analyser fixes

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

 



hi Julian,

I have modified patch according to your suggestion. 

Subject: [PATCH] iw: Static analyser fixes

Signed-off-by: Amit Khatri <amit.khatri@xxxxxxxxxxx>
Signed-off-by: Rahul Jain <rahul.jain@xxxxxxxxxxx>
---
 cqm.c   | 2 ++
 event.c | 4 +++-
 iw.c    | 2 +-
 scan.c  | 2 ++
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cqm.c b/cqm.c
index 65876af..bf60401 100644
--- a/cqm.c
+++ b/cqm.c
@@ -34,6 +34,8 @@ static int iw_cqm_rssi(struct nl80211_state *state, struct nl_cb *cb,
 
 	/* connection quality monitor attributes */
 	cqm = nlmsg_alloc();
+	if(!cqm)
+		return -ENOMEM;
 
 	NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_THOLD, thold);
 	NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_HYST, hyst);
diff --git a/event.c b/event.c
index f73e078..50b3b17 100644
--- a/event.c
+++ b/event.c
@@ -49,8 +49,10 @@ static void print_frame(struct print_event_args *args, struct nlattr *attr)
 	char macbuf[6*3];
 	uint16_t tmp;
 
-	if (!attr)
+	if (!attr) {
 		printf(" [no frame]");
+		return;
+	}
 
 	frame = nla_data(attr);
 	len = nla_len(attr);
diff --git a/iw.c b/iw.c
index dc99566..1e913b6 100644
--- a/iw.c
+++ b/iw.c
@@ -477,8 +477,8 @@ static int __handle_cmd(struct nl80211_state *state, enum id_input idby,
 	while (err > 0)
 		nl_recvmsgs(state->nl_sock, cb);
  out:
-	nl_cb_put(cb);
  out_free_msg:
+	nl_cb_put(cb);
 	nlmsg_free(msg);
 	return err;
  nla_put_failure:
diff --git a/scan.c b/scan.c
index bf39f34..5483c1d 100644
--- a/scan.c
+++ b/scan.c
@@ -409,6 +409,8 @@ static int handle_scan(struct nl80211_state *state,
 				break;
 			}
 		case DONE:
+			nlmsg_free(ssids);
+			nlmsg_free(freqs);
 			return 1;
 		case FREQ:
 			freq = strtoul(argv[i], &eptr, 10);
-- 
1.9.1


------- Original Message -------
Sender : Julian Calaby<julian.calaby@xxxxxxxxx> 
Date   : Jun 30, 2015 17:59 (GMT+05:30)
Title  : Re: [PATCH] iw: Static analyser fixes

Hi Amit,

On Tue, Jun 30, 2015 at 10:17 PM, Amit Khatri <amit.khatri@xxxxxxxxxxx> wrote:
> Hi Johannes,
>
> Subject: [PATCH] iw: Static analyser fixes
>
> Signed-off-by: Amit Khatri <amit.khatri@xxxxxxxxxxx>
> Signed-off-by: Rahul Jain <rahul.jain@xxxxxxxxxxx>
> ---
>  cqm.c   | 2 ++
>  event.c | 6 +++++-
>  iw.c    | 2 +-
>  scan.c  | 2 ++
>  4 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/event.c b/event.c
> index f73e078..06d236b 100644
> --- a/event.c
> +++ b/event.c
> @@ -49,8 +49,10 @@ static void print_frame(struct print_event_args *args, struct nlattr *attr)
>         char macbuf[6*3];
>         uint16_t tmp;
>
> -       if (!attr)
> +       if (!attr) {
>                 printf(" [no frame]");
> +               goto out;
> +       }
>
>         frame = nla_data(attr);
>         len = nla_len(attr);
> @@ -97,6 +99,8 @@ static void print_frame(struct print_event_args *args, struct nlattr *attr)
>         for (i = 0; i < len; i++)
>                 printf(" %.02x", frame[i]);
>         printf("]");
> + out:
> +       ;  /*empty statement to avoid compiler error */

Er, why not just return in the if (!attr) block?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@xxxxxxxxx
Profile: http://www.google.com/profiles/julian.calaby/
<p>&nbsp;</p><p>&nbsp;</p>��.n��������+%������w��{.n�����{���zW����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux