[PATCH][Trivial] tcp: correct code comment stating 3 min timeout for FIN_WAIT2, we only do 1 min

2014-02-09 Thread Jesper Juhl
As far as I can tell we have used a default of 60 seconds for
FIN_WAIT2 timeout for ages (since 2.x times??).

In any case, the timeout these days is 60 seconds, so the 3 min
comment is wrong (and cost me a few minutes of my life when I was
debugging a FIN_WAIT2 related problem in a userspace application and
checked the kernel source for details).

Signed-off-by: Jesper Juhl 
---
 net/ipv4/tcp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4475b3b..9f3a2db 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2229,7 +2229,7 @@ adjudge_to_death:
/*  This is a (useful) BSD violating of the RFC. There is a
 *  problem with TCP as specified in that the other end could
 *  keep a socket open forever with no application left this end.
-*  We use a 3 minute timeout (about the same as BSD) then kill
+*  We use a 1 minute timeout (about the same as BSD) then kill
 *  our end. If they send after that then tough - BUT: long enough
 *  that we won't make the old 4*rto = almost no time - whoops
 *  reset mistake.
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][Trivial] tcp: correct code comment stating 3 min timeout for FIN_WAIT2, we only do 1 min

2014-02-09 Thread Jesper Juhl
As far as I can tell we have used a default of 60 seconds for
FIN_WAIT2 timeout for ages (since 2.x times??).

In any case, the timeout these days is 60 seconds, so the 3 min
comment is wrong (and cost me a few minutes of my life when I was
debugging a FIN_WAIT2 related problem in a userspace application and
checked the kernel source for details).

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 net/ipv4/tcp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4475b3b..9f3a2db 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2229,7 +2229,7 @@ adjudge_to_death:
/*  This is a (useful) BSD violating of the RFC. There is a
 *  problem with TCP as specified in that the other end could
 *  keep a socket open forever with no application left this end.
-*  We use a 3 minute timeout (about the same as BSD) then kill
+*  We use a 1 minute timeout (about the same as BSD) then kill
 *  our end. If they send after that then tough - BUT: long enough
 *  that we won't make the old 4*rto = almost no time - whoops
 *  reset mistake.
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [IA64] aliasing-test: fix mem leaks

2013-09-30 Thread Jesper Juhl
Fix a few trivial mem leaks when returning from scan_tree/scan_rom.

Signed-off-by: Jesper Juhl 
---
 Documentation/ia64/aliasing-test.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Documentation/ia64/aliasing-test.c 
b/Documentation/ia64/aliasing-test.c
index 62a190d..33ed7a7 100644
--- a/Documentation/ia64/aliasing-test.c
+++ b/Documentation/ia64/aliasing-test.c
@@ -96,6 +96,7 @@ static int scan_tree(char *path, char *file, off_t offset, 
size_t length, int to
fprintf(stderr, "PASS: %s 0x%lx-0x%lx not 
mappable\n", path2, offset, offset + length);
else {
fprintf(stderr, "FAIL: %s 0x%lx-0x%lx not 
accessible\n", path2, offset, offset + length);
+   free(path2);
return rc;
}
} else {
@@ -185,6 +186,7 @@ static int scan_rom(char *path, char *file)
fprintf(stderr, "PASS: %s read %d bytes\n", 
path2, rc);
else {
fprintf(stderr, "PASS: %s not readable\n", 
path2);
+   free(path2);
return rc;
}
    } else {
-- 
1.7.1

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: lustre: Don't leak 'buffer' in cfs_get_environ()

2013-09-30 Thread Jesper Juhl
If 'down_read_trylock' fails we'll curently leak the memory allocated to 
'buffer'.
Fix the leak by simply kfree'ing 'buffer' before returning '-EDEADLK'.

Signed-off-by: Jesper Juhl 
---
 .../lustre/lustre/libcfs/linux/linux-curproc.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index ea9e949..ecd031f 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -227,8 +227,10 @@ int cfs_get_environ(const char *key, char *value, int 
*val_len)
 * which is already holding mmap_sem for writes.  If some other
 * thread gets the write lock in the meantime, this thread will
 * block, but at least it won't deadlock on itself.  LU-1735 */
-   if (down_read_trylock(>mmap_sem) == 0)
+   if (down_read_trylock(>mmap_sem) == 0) {
+   kfree(buffer);
return -EDEADLK;
+   }
up_read(>mmap_sem);
 
addr = mm->env_start;
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: vt6655: don't leak when returning -EOPNOTSUPP in vt6655_hostap_ioctl

2013-09-30 Thread Jesper Juhl
Make sure we always free(param); and remove a redundant "goto out;"
just before we'll hit the label anyway.

Signed-off-by: Jesper Juhl 
---
 drivers/staging/vt6655/hostap.c |   25 ++---
 1 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
index 8acff44..fdd63b6 100644
--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
@@ -720,7 +720,6 @@ static int hostap_get_encryption(PSDevice pDevice,
  * Return Value:
  *
  */
-
 int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
 {
struct viawget_hostapd_param *param;
@@ -755,8 +754,8 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point 
*p)
break;
case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
"VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n");
-   return -EOPNOTSUPP;
-   break;
+   ret = -EOPNOTSUPP;
+   goto out;
case VIAWGET_HOSTAPD_FLUSH:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_FLUSH \n");
spin_lock_irq(>lock);
@@ -790,40 +789,36 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point 
*p)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
"VIAWGET_HOSTAPD_SET_FLAGS_STA \n");
ret = hostap_set_flags_sta(pDevice, param);
break;
-
case VIAWGET_HOSTAPD_MLME:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_MLME \n");
-   return -EOPNOTSUPP;
-
+   ret = -EOPNOTSUPP;
+   goto out;
case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
"VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n");
ret = hostap_set_generic_element(pDevice, param);
break;
-
case VIAWGET_HOSTAPD_SCAN_REQ:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SCAN_REQ 
\n");
-   return -EOPNOTSUPP;
-
+   ret = -EOPNOTSUPP;
+   goto out;
case VIAWGET_HOSTAPD_STA_CLEAR_STATS:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
"VIAWGET_HOSTAPD_STA_CLEAR_STATS \n");
-   return -EOPNOTSUPP;
-
+   ret = -EOPNOTSUPP;
+   goto out;
default:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: 
unknown cmd=%d\n",
(int)param->cmd);
-   return -EOPNOTSUPP;
-   break;
+   ret = -EOPNOTSUPP;
+   goto out;
}
 
if ((ret == 0) && ap_ioctl) {
if (copy_to_user(p->pointer, param, p->length)) {
ret = -EFAULT;
-   goto out;
}
}
 
 out:
kfree(param);
-
return ret;
 }
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [SCSI] mpt3sas: don't leak 'fw_event' in mpt3sas_send_trigger_data_event()

2013-09-30 Thread Jesper Juhl
If we successfully allocate 'fw_event' but subsequently fail to
allocate 'fw_event->event_data' then we'll return from the function
without properly freeing 'fw_event'.
This patch takes care of that leak.

Signed-off-by: Jesper Juhl 
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index a961fe1..e90fbf3 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -2518,8 +2518,10 @@ mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER 
*ioc,
if (!fw_event)
return;
fw_event->event_data = kzalloc(sizeof(*event_data), GFP_ATOMIC);
-   if (!fw_event->event_data)
+   if (!fw_event->event_data) {
+   kfree(fw_event);
return;
+   }
fw_event->event = MPT3SAS_PROCESS_TRIGGER_DIAG;
fw_event->ioc = ioc;
memcpy(fw_event->event_data, event_data, sizeof(*event_data));
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] isdn: eicon: free pointer after using it in log msg in divas_um_idi_delete_entity()

2013-09-30 Thread Jesper Juhl
Not really a problem, but nice IMHO; the Coverity static analyzer
complains that we use the pointer 'e' after it has been freed, so move
the freeing below the final use, even if that use is just using the
value of the pointer and not actually dereferencing it.

Signed-off-by: Jesper Juhl 
---
 drivers/isdn/hardware/eicon/um_idi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/um_idi.c 
b/drivers/isdn/hardware/eicon/um_idi.c
index 7cab5c3..e151971 100644
--- a/drivers/isdn/hardware/eicon/um_idi.c
+++ b/drivers/isdn/hardware/eicon/um_idi.c
@@ -288,9 +288,9 @@ int divas_um_idi_delete_entity(int adapter_nr, void *entity)
cleanup_entity(e);
diva_os_free(0, e->os_context);
memset(e, 0x00, sizeof(*e));
-   diva_os_free(0, e);

DBG_LOG(("A(%d) remove E:%08x", adapter_nr, e));
+   diva_os_free(0, e);

return (0);
 }
--
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] isdn: eicon: free pointer after using it in log msg in divas_um_idi_delete_entity()

2013-09-30 Thread Jesper Juhl
Not really a problem, but nice IMHO; the Coverity static analyzer
complains that we use the pointer 'e' after it has been freed, so move
the freeing below the final use, even if that use is just using the
value of the pointer and not actually dereferencing it.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/isdn/hardware/eicon/um_idi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/um_idi.c 
b/drivers/isdn/hardware/eicon/um_idi.c
index 7cab5c3..e151971 100644
--- a/drivers/isdn/hardware/eicon/um_idi.c
+++ b/drivers/isdn/hardware/eicon/um_idi.c
@@ -288,9 +288,9 @@ int divas_um_idi_delete_entity(int adapter_nr, void *entity)
cleanup_entity(e);
diva_os_free(0, e-os_context);
memset(e, 0x00, sizeof(*e));
-   diva_os_free(0, e);

DBG_LOG((A(%d) remove E:%08x, adapter_nr, e));
+   diva_os_free(0, e);

return (0);
 }
--
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [SCSI] mpt3sas: don't leak 'fw_event' in mpt3sas_send_trigger_data_event()

2013-09-30 Thread Jesper Juhl
If we successfully allocate 'fw_event' but subsequently fail to
allocate 'fw_event-event_data' then we'll return from the function
without properly freeing 'fw_event'.
This patch takes care of that leak.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index a961fe1..e90fbf3 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -2518,8 +2518,10 @@ mpt3sas_send_trigger_data_event(struct MPT3SAS_ADAPTER 
*ioc,
if (!fw_event)
return;
fw_event-event_data = kzalloc(sizeof(*event_data), GFP_ATOMIC);
-   if (!fw_event-event_data)
+   if (!fw_event-event_data) {
+   kfree(fw_event);
return;
+   }
fw_event-event = MPT3SAS_PROCESS_TRIGGER_DIAG;
fw_event-ioc = ioc;
memcpy(fw_event-event_data, event_data, sizeof(*event_data));
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: vt6655: don't leak when returning -EOPNOTSUPP in vt6655_hostap_ioctl

2013-09-30 Thread Jesper Juhl
Make sure we always free(param); and remove a redundant goto out;
just before we'll hit the label anyway.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/staging/vt6655/hostap.c |   25 ++---
 1 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
index 8acff44..fdd63b6 100644
--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
@@ -720,7 +720,6 @@ static int hostap_get_encryption(PSDevice pDevice,
  * Return Value:
  *
  */
-
 int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
 {
struct viawget_hostapd_param *param;
@@ -755,8 +754,8 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point 
*p)
break;
case VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR \n);
-   return -EOPNOTSUPP;
-   break;
+   ret = -EOPNOTSUPP;
+   goto out;
case VIAWGET_HOSTAPD_FLUSH:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO VIAWGET_HOSTAPD_FLUSH \n);
spin_lock_irq(pDevice-lock);
@@ -790,40 +789,36 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point 
*p)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
VIAWGET_HOSTAPD_SET_FLAGS_STA \n);
ret = hostap_set_flags_sta(pDevice, param);
break;
-
case VIAWGET_HOSTAPD_MLME:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO VIAWGET_HOSTAPD_MLME \n);
-   return -EOPNOTSUPP;
-
+   ret = -EOPNOTSUPP;
+   goto out;
case VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT \n);
ret = hostap_set_generic_element(pDevice, param);
break;
-
case VIAWGET_HOSTAPD_SCAN_REQ:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO VIAWGET_HOSTAPD_SCAN_REQ 
\n);
-   return -EOPNOTSUPP;
-
+   ret = -EOPNOTSUPP;
+   goto out;
case VIAWGET_HOSTAPD_STA_CLEAR_STATS:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO 
VIAWGET_HOSTAPD_STA_CLEAR_STATS \n);
-   return -EOPNOTSUPP;
-
+   ret = -EOPNOTSUPP;
+   goto out;
default:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO vt6655_hostap_ioctl: 
unknown cmd=%d\n,
(int)param-cmd);
-   return -EOPNOTSUPP;
-   break;
+   ret = -EOPNOTSUPP;
+   goto out;
}
 
if ((ret == 0)  ap_ioctl) {
if (copy_to_user(p-pointer, param, p-length)) {
ret = -EFAULT;
-   goto out;
}
}
 
 out:
kfree(param);
-
return ret;
 }
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: lustre: Don't leak 'buffer' in cfs_get_environ()

2013-09-30 Thread Jesper Juhl
If 'down_read_trylock' fails we'll curently leak the memory allocated to 
'buffer'.
Fix the leak by simply kfree'ing 'buffer' before returning '-EDEADLK'.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 .../lustre/lustre/libcfs/linux/linux-curproc.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c 
b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
index ea9e949..ecd031f 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
@@ -227,8 +227,10 @@ int cfs_get_environ(const char *key, char *value, int 
*val_len)
 * which is already holding mmap_sem for writes.  If some other
 * thread gets the write lock in the meantime, this thread will
 * block, but at least it won't deadlock on itself.  LU-1735 */
-   if (down_read_trylock(mm-mmap_sem) == 0)
+   if (down_read_trylock(mm-mmap_sem) == 0) {
+   kfree(buffer);
return -EDEADLK;
+   }
up_read(mm-mmap_sem);
 
addr = mm-env_start;
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [IA64] aliasing-test: fix mem leaks

2013-09-30 Thread Jesper Juhl
Fix a few trivial mem leaks when returning from scan_tree/scan_rom.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 Documentation/ia64/aliasing-test.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Documentation/ia64/aliasing-test.c 
b/Documentation/ia64/aliasing-test.c
index 62a190d..33ed7a7 100644
--- a/Documentation/ia64/aliasing-test.c
+++ b/Documentation/ia64/aliasing-test.c
@@ -96,6 +96,7 @@ static int scan_tree(char *path, char *file, off_t offset, 
size_t length, int to
fprintf(stderr, PASS: %s 0x%lx-0x%lx not 
mappable\n, path2, offset, offset + length);
else {
fprintf(stderr, FAIL: %s 0x%lx-0x%lx not 
accessible\n, path2, offset, offset + length);
+   free(path2);
return rc;
}
} else {
@@ -185,6 +186,7 @@ static int scan_rom(char *path, char *file)
fprintf(stderr, PASS: %s read %d bytes\n, 
path2, rc);
else {
fprintf(stderr, PASS: %s not readable\n, 
path2);
+   free(path2);
return rc;
}
} else {
-- 
1.7.1

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Unchecked Null pointers

2013-02-04 Thread Jesper Juhl
On Fri, 1 Feb 2013, syrine tlili wrote:

> Hi:
> I would like to report a set of errors found in the source tree of
> Linux version 3.0.52 using a static analysis tool for vulnerability
> detection that I'm developing  based on GCC.

Cool. New useful tools are always nice. Where can I download it/look at 
its source code?


> I have performed the security analysis on the whole linux 3.0.52
> distribution and my tool detected 18 errors related to the use of
> unchecked potential  null pointers.

May I suggest that you run your tool against a more recent code-base, such 
as the lastest stable kernel (atm 3.7.6) or the latest 3.8-rc kernel 
(currently 3.8-rc6) or a daily snapshor of Linus' kernel.
That may gain you more feedback from people.


> Some of these errors are also present in recent kernel versions such
> as version 3.6.4
> Details on the detected errors are listed below.
> I'm looking forward to getting your feedback on the reported errors.
> 
[...]

I'd suggest, that a more useful way of getting feedback would be to run 
the tool against a more recent (relevant) kernel source and then submit 
actual patches attempting to *fix* the problems you find. That would be 
more likely to get peoples attention - and would also potentially result 
in some nice fixes being merged.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Unchecked Null pointers

2013-02-04 Thread Jesper Juhl
On Fri, 1 Feb 2013, syrine tlili wrote:

 Hi:
 I would like to report a set of errors found in the source tree of
 Linux version 3.0.52 using a static analysis tool for vulnerability
 detection that I'm developing  based on GCC.

Cool. New useful tools are always nice. Where can I download it/look at 
its source code?


 I have performed the security analysis on the whole linux 3.0.52
 distribution and my tool detected 18 errors related to the use of
 unchecked potential  null pointers.

May I suggest that you run your tool against a more recent code-base, such 
as the lastest stable kernel (atm 3.7.6) or the latest 3.8-rc kernel 
(currently 3.8-rc6) or a daily snapshor of Linus' kernel.
That may gain you more feedback from people.


 Some of these errors are also present in recent kernel versions such
 as version 3.6.4
 Details on the detected errors are listed below.
 I'm looking forward to getting your feedback on the reported errors.
 
[...]

I'd suggest, that a more useful way of getting feedback would be to run 
the tool against a more recent (relevant) kernel source and then submit 
actual patches attempting to *fix* the problems you find. That would be 
more likely to get peoples attention - and would also potentially result 
in some nice fixes being merged.

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][trivial] pcmcia: avoid static analysis complaint about use-after-free

2013-01-20 Thread Jesper Juhl
Coverity complains about a use after free for 'res1' and 'res2' since
we use the value of the pointers in a 'dev_dbg()' after they have been
freed. That's not really a problem, but it still seems cleaner to
defer freeing until we are completely done with the pointers.

Signed-off-by: Jesper Juhl 
---
 drivers/pcmcia/rsrc_nonstatic.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 430a9ac..065704c 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -369,12 +369,12 @@ static int do_validate_mem(struct pcmcia_socket *s,
}
}
 
-   free_region(res2);
-   free_region(res1);
-
dev_dbg(>dev, "cs: memory probe 0x%06lx-0x%06lx: %p %p %u %u %u",
base, base+size-1, res1, res2, ret, info1, info2);
 
+   free_region(res2);
+   free_region(res1);
+
if ((ret) || (info1 != info2) || (info1 == 0))
return -EINVAL;
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][trivial] pcmcia: avoid static analysis complaint about use-after-free

2013-01-20 Thread Jesper Juhl
Coverity complains about a use after free for 'res1' and 'res2' since
we use the value of the pointers in a 'dev_dbg()' after they have been
freed. That's not really a problem, but it still seems cleaner to
defer freeing until we are completely done with the pointers.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/pcmcia/rsrc_nonstatic.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 430a9ac..065704c 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -369,12 +369,12 @@ static int do_validate_mem(struct pcmcia_socket *s,
}
}
 
-   free_region(res2);
-   free_region(res1);
-
dev_dbg(s-dev, cs: memory probe 0x%06lx-0x%06lx: %p %p %u %u %u,
base, base+size-1, res1, res2, ret, info1, info2);
 
+   free_region(res2);
+   free_region(res1);
+
if ((ret) || (info1 != info2) || (info1 == 0))
return -EINVAL;
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] IB: cxgb3: delay freeing mem untill entirely done with it

2013-01-14 Thread Jesper Juhl
Sure, it's just the pointer value we use, but the coverity checker
complains about a use-after-free bug and it really does seem cleaner
to delay freeing until we are entirely done with the memory. So,
rearrange the code to move the kfree() later untill we are completely
done.
Trivial and harmless, but nice IMHO.

Signed-off-by: Jesper Juhl 
---
 drivers/infiniband/hw/cxgb3/iwch_provider.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 0bdf09a..145d82a 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -783,8 +783,8 @@ static int iwch_dealloc_mw(struct ib_mw *mw)
mmid = (mw->rkey) >> 8;
cxio_deallocate_window(>rdev, mhp->attr.stag);
remove_handle(rhp, >mmidr, mmid);
-   kfree(mhp);
PDBG("%s ib_mw %p mmid 0x%x ptr %p\n", __func__, mw, mmid, mhp);
+   kfree(mhp);
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] IB: cxgb3: delay freeing mem untill entirely done with it

2013-01-14 Thread Jesper Juhl
Sure, it's just the pointer value we use, but the coverity checker
complains about a use-after-free bug and it really does seem cleaner
to delay freeing until we are entirely done with the memory. So,
rearrange the code to move the kfree() later untill we are completely
done.
Trivial and harmless, but nice IMHO.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/infiniband/hw/cxgb3/iwch_provider.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 0bdf09a..145d82a 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -783,8 +783,8 @@ static int iwch_dealloc_mw(struct ib_mw *mw)
mmid = (mw-rkey)  8;
cxio_deallocate_window(rhp-rdev, mhp-attr.stag);
remove_handle(rhp, rhp-mmidr, mmid);
-   kfree(mhp);
PDBG(%s ib_mw %p mmid 0x%x ptr %p\n, __func__, mw, mmid, mhp);
+   kfree(mhp);
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] relay: use sizeof(size_t), not sizeof(size_t *) in relay_create_buf()

2012-12-30 Thread Jesper Juhl
A number of size_t's is what we want to allocate memory for, not a
number of size_t pointers (at least as far as I can tell).
Now, depending on platform, sizeof(size_t *) may be >= sizeof(size_t)
so things actually work, but that's not really a portable assumption,
so let's use the value we actually mean.

Signed-off-by: Jesper Juhl 
---
 kernel/relay.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/relay.c b/kernel/relay.c
index e8cd202..806931b 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -166,13 +166,13 @@ static struct rchan_buf *relay_create_buf(struct rchan 
*chan)
 {
struct rchan_buf *buf;
 
-   if (chan->n_subbufs > UINT_MAX / sizeof(size_t *))
+   if (chan->n_subbufs > UINT_MAX / sizeof(size_t))
return NULL;
 
buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
if (!buf)
return NULL;
-   buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL);
+   buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t), GFP_KERNEL);
if (!buf->padding)
goto free_buf;
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] relay: use sizeof(size_t), not sizeof(size_t *) in relay_create_buf()

2012-12-30 Thread Jesper Juhl
A number of size_t's is what we want to allocate memory for, not a
number of size_t pointers (at least as far as I can tell).
Now, depending on platform, sizeof(size_t *) may be = sizeof(size_t)
so things actually work, but that's not really a portable assumption,
so let's use the value we actually mean.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 kernel/relay.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/relay.c b/kernel/relay.c
index e8cd202..806931b 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -166,13 +166,13 @@ static struct rchan_buf *relay_create_buf(struct rchan 
*chan)
 {
struct rchan_buf *buf;
 
-   if (chan-n_subbufs  UINT_MAX / sizeof(size_t *))
+   if (chan-n_subbufs  UINT_MAX / sizeof(size_t))
return NULL;
 
buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
if (!buf)
return NULL;
-   buf-padding = kmalloc(chan-n_subbufs * sizeof(size_t *), GFP_KERNEL);
+   buf-padding = kmalloc(chan-n_subbufs * sizeof(size_t), GFP_KERNEL);
if (!buf-padding)
goto free_buf;
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [SCSI] mpt3sas: remove pointless version.h include from mpt3sas_trigger_diag.c

2012-12-29 Thread Jesper Juhl
The file uses nothing from the header, so remove it.

Signed-off-by: Jesper Juhl 
---
 drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
index da6c5f2..6f8d621 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
@@ -42,7 +42,6 @@
  * USA.
  */
 
-#include 
 #include 
 #include 
 #include 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [SCSI] mpt3sas: remove pointless version.h include from mpt3sas_trigger_diag.c

2012-12-29 Thread Jesper Juhl
The file uses nothing from the header, so remove it.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
index da6c5f2..6f8d621 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
@@ -42,7 +42,6 @@
  * USA.
  */
 
-#include linux/version.h
 #include linux/kernel.h
 #include linux/module.h
 #include linux/errno.h
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] scripts/tags.sh: Fix regex syntax for etags

2012-12-28 Thread Jesper Juhl
On Sat, 29 Dec 2012, Andreas Schwab wrote:

> Signed-off-by: Andreas Schwab 
> ---
>  scripts/tags.sh | 50 +-
>  1 file changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/scripts/tags.sh b/scripts/tags.sh
> index 08f06c0..4c53b7d 100755
> --- a/scripts/tags.sh
> +++ b/scripts/tags.sh
> @@ -201,34 +201,34 @@ exuberant()
>  emacs()
>  {
>   all_target_sources | xargs $1 -a\
> - --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'\
> + --regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/' \
>   --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
>   --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'  \
>   --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
> - --regex='/PAGEFLAG\(([^,)]*).*/Page\1/' \
> - --regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/'  \
> - --regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/'\
> - --regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/'   \
> - --regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
> - --regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/'   \
> - --regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/'   \
> - --regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/'   \
> - --regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
> - --regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/'   \
> - --regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/'   \
> - --regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/'  \
> - --regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/'\
> - --regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/'   \
> - --regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/'\
> - --regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/'  \
> - --regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/'  \
> - --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/'  \
> - --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
> - --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
> - --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
> - --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'\
> - --regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \
> - --regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/'
> + --regex='/PAGEFLAG(\([^,)]*\).*/Page\1/'\
> + --regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \
> + --regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/'   \
> + --regex='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/'  \
> + --regex='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/'\
> + --regex='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/'  \
> + --regex='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/'  \
> + --regex='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'  \
> + --regex='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'\
> + --regex='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/'  \
> + --regex='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/'  \
> + --regex='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
> + --regex='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/'   \
> + --regex='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/'  \
> + --regex='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/'   \
> + --regex='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/' \
> + --regex='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/' \
> + --regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \
> + --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
> + --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
> + --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \
> + --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'   \
> + --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
> + --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
>  
>   all_kconfigs | xargs $1 -a  \
>   --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
> 

This works for me. Thanks.

Tested-by: Jesper Juhl 


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: how to look for source code in kernel

2012-12-28 Thread Jesper Juhl
On Fri, 28 Dec 2012, Guennadi Liakhovetski wrote:

> On Fri, 28 Dec 2012, Borislav Petkov wrote:
> 
> > On Thu, Dec 27, 2012 at 11:36:13PM -0800, Eric W. Biederman wrote:
> > > git-ls-files | xargs fgrep 'struct f2fs_inode'
> > > 
> > > That returns instantly and tells me where to look.  If you can do an
> > > instant brute force search what is the point of an index?
> > 
> > Not if you're using a lame-ass laptop with a rotating disk:
> > 
> > $ time git ls-files | xargs grep -E 'struct mce\W*{'
> > arch/x86/include/uapi/asm/mce.h:struct mce {
> > arch/x86/kernel/cpu/mcheck/mce.c:   if (!final || memcmp(m, 
> > final, sizeof(struct mce))) {
> > 
> > real2m48.415s
> > user0m2.388s
> > sys 0m15.668s
> > 
> > What I've grown accustomed to is cscope with a prior find run on the
> > kernel source tree to create a custom cscope.files which cscope uses to
> > index and then using vim bindings in cscope so that if, for example, the
> > cursor is on a function call, executing a keyboard shortcut opens the
> > definition of that function in another vim tab. I.e., a thin IDE done
> > right.
> 
> ...same works with TAGS under emacs, the only annoying problem with it 
> since "recently" (about half a year or more) is that "make TAGS" is 
> spewing out tons of
> 
> etags: Unmatched ( or \( while compiling pattern
> 
> oh well, looks like noone is using it / noone cares enough...
> 
I use it. I haven't bothered (yet) to look into the cause of the message 
it spews since the etags ('TAGS') file it produces still seems to work 
well enough.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: how to look for source code in kernel

2012-12-28 Thread Jesper Juhl
On Fri, 28 Dec 2012, Guennadi Liakhovetski wrote:

 On Fri, 28 Dec 2012, Borislav Petkov wrote:
 
  On Thu, Dec 27, 2012 at 11:36:13PM -0800, Eric W. Biederman wrote:
   git-ls-files | xargs fgrep 'struct f2fs_inode'
   
   That returns instantly and tells me where to look.  If you can do an
   instant brute force search what is the point of an index?
  
  Not if you're using a lame-ass laptop with a rotating disk:
  
  $ time git ls-files | xargs grep -E 'struct mce\W*{'
  arch/x86/include/uapi/asm/mce.h:struct mce {
  arch/x86/kernel/cpu/mcheck/mce.c:   if (!final || memcmp(m, 
  final, sizeof(struct mce))) {
  
  real2m48.415s
  user0m2.388s
  sys 0m15.668s
  
  What I've grown accustomed to is cscope with a prior find run on the
  kernel source tree to create a custom cscope.files which cscope uses to
  index and then using vim bindings in cscope so that if, for example, the
  cursor is on a function call, executing a keyboard shortcut opens the
  definition of that function in another vim tab. I.e., a thin IDE done
  right.
 
 ...same works with TAGS under emacs, the only annoying problem with it 
 since recently (about half a year or more) is that make TAGS is 
 spewing out tons of
 
 etags: Unmatched ( or \( while compiling pattern
 
 oh well, looks like noone is using it / noone cares enough...
 
I use it. I haven't bothered (yet) to look into the cause of the message 
it spews since the etags ('TAGS') file it produces still seems to work 
well enough.

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] scripts/tags.sh: Fix regex syntax for etags

2012-12-28 Thread Jesper Juhl
On Sat, 29 Dec 2012, Andreas Schwab wrote:

 Signed-off-by: Andreas Schwab sch...@linux-m68k.org
 ---
  scripts/tags.sh | 50 +-
  1 file changed, 25 insertions(+), 25 deletions(-)
 
 diff --git a/scripts/tags.sh b/scripts/tags.sh
 index 08f06c0..4c53b7d 100755
 --- a/scripts/tags.sh
 +++ b/scripts/tags.sh
 @@ -201,34 +201,34 @@ exuberant()
  emacs()
  {
   all_target_sources | xargs $1 -a\
 - --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'\
 + --regex='/^\(ENTRY\|_GLOBAL\)(\([^)]*\)).*/\2/' \
   --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
   --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'  \
   --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \
 - --regex='/PAGEFLAG\(([^,)]*).*/Page\1/' \
 - --regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/'  \
 - --regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/'\
 - --regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/'   \
 - --regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \
 - --regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/'   \
 - --regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/'   \
 - --regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/'   \
 - --regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \
 - --regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/'   \
 - --regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/'   \
 - --regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/'  \
 - --regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/'\
 - --regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/'   \
 - --regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/'\
 - --regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/'  \
 - --regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/'  \
 - --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/'  \
 - --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \
 - --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \
 - --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \
 - --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'\
 - --regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \
 - --regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/'
 + --regex='/PAGEFLAG(\([^,)]*\).*/Page\1/'\
 + --regex='/PAGEFLAG(\([^,)]*\).*/SetPage\1/' \
 + --regex='/PAGEFLAG(\([^,)]*\).*/ClearPage\1/'   \
 + --regex='/TESTSETFLAG(\([^,)]*\).*/TestSetPage\1/'  \
 + --regex='/TESTPAGEFLAG(\([^,)]*\).*/Page\1/'\
 + --regex='/SETPAGEFLAG(\([^,)]*\).*/SetPage\1/'  \
 + --regex='/__SETPAGEFLAG(\([^,)]*\).*/__SetPage\1/'  \
 + --regex='/TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'  \
 + --regex='/__TESTCLEARFLAG(\([^,)]*\).*/TestClearPage\1/'\
 + --regex='/CLEARPAGEFLAG(\([^,)]*\).*/ClearPage\1/'  \
 + --regex='/__CLEARPAGEFLAG(\([^,)]*\).*/__ClearPage\1/'  \
 + --regex='/__PAGEFLAG(\([^,)]*\).*/__SetPage\1/' \
 + --regex='/__PAGEFLAG(\([^,)]*\).*/__ClearPage\1/'   \
 + --regex='/PAGEFLAG_FALSE(\([^,)]*\).*/Page\1/'  \
 + --regex='/TESTSCFLAG(\([^,)]*\).*/TestSetPage\1/'   \
 + --regex='/TESTSCFLAG(\([^,)]*\).*/TestClearPage\1/' \
 + --regex='/SETPAGEFLAG_NOOP(\([^,)]*\).*/SetPage\1/' \
 + --regex='/CLEARPAGEFLAG_NOOP(\([^,)]*\).*/ClearPage\1/' \
 + --regex='/__CLEARPAGEFLAG_NOOP(\([^,)]*\).*/__ClearPage\1/' \
 + --regex='/TESTCLEARFLAG_FALSE(\([^,)]*\).*/TestClearPage\1/' \
 + --regex='/__TESTCLEARFLAG_FALSE(\([^,)]*\).*/__TestClearPage\1/' \
 + --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'   \
 + --regex='/PCI_OP_READ(\([a-z]*[a-z]\).*[1-4])/pci_bus_read_config_\1/' \
 + --regex='/PCI_OP_WRITE(\([a-z]*[a-z]\).*[1-4])/pci_bus_write_config_\1/'
  
   all_kconfigs | xargs $1 -a  \
   --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
 

This works for me. Thanks.

Tested-by: Jesper Juhl j...@chaosbits.net


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [tip:x86/build] x86: Default to ARCH= x86 to avoid overriding CONFIG_64BIT

2012-12-26 Thread Jesper Juhl
On Wed, 26 Dec 2012, David Rientjes wrote:

> On Wed, 26 Dec 2012, David Woodhouse wrote:
> 
> > > I'm sure it's a 32-bit issue, nothing has changed recently in auto-latest 
> > > related to these subsystems and I'm sure it's just because my randconfig 
> > > builds were exposed to this combination solely because of this patch.
> > 
> > Hm, that's an unexpected benefit of this patch. I didn't think it would
> > noticeably improve 'make randconfig' coverage of configs without
> > CONFIG_64BIT, because I thought enough people were doing such tests
> > already. But evidently I was wrong.
> > 
> 
> I do quite a bit of automated config and boot tests to try out 
> combinations that others may not have tested when developing their code; 
> staging branches such as in tip are interesting to try because they 
> haven't yet reached Linus and it's helpful to catch breakages before it 
> reaches mainline.
> 
> > We introduced 'make randconfig' as a tool to generate meaningless
> > configs just to test various permutations — to ensure that we got our
> > dependencies right both in Kconfig and the code itself. It was
> > artificially limiting its test coverage and thus we were failing to
> > discover real bugs. Now I've fixed that problem, and 'make randconfig'
> > is actually random and is thus doing its job even better than before.
> > Yay!
> > 
> 
> Umm, you're saying that is legitimate for "make randconfig" done on a 
> 32-bit machine to generate 64-bit configurations?  The resulting kernel 
> cannot be booted.  In the past, "make randconfig" would always generate a 
> kernel that _should_ boot on that machine unless there was an underlying 
> bug that should be fixed.
> 
...

Why would you assume a bootable kernel from 'randconfig'? I don't and 
never have. If we stick to X86, then you may get a kernel config without 
x387/emulator support - try to boot boot that on a 486sx. You may also get 
a config that does not contain the filesystem(s) you use, or without the 
driver for your main HD. You may also be out of luck with graphics 
drivers or support for your mouse/keyboard combo. etc etc.

In my view, randconfig was never about building bootable kernels, but all 
about building possible kernel config combinations - that may or may not 
boot on any given system.  The point was only to test that some 
combination of options did in fact build (if it also boots then all the 
better, but that was never part of the goal; as I saw it).

I may be wrong, but that was/is my expectations for 'randconfig'.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


[PATCH] netfilter: Don't leak 'exp' in ctnetlink_create_expect()

2012-12-26 Thread Jesper Juhl
'if ((!help) && (!cda[CTA_EXPECT_TIMEOUT]))' then we should remember
to free 'exp' that was allocated by 'nf_ct_expect_alloc()' by jumping
to the 'err_out' label rather than the 'out' label in
ctnetlink_create_expect().
This patch should get rid of the leak.

Signed-off-by: Jesper Juhl 
---
 net/netfilter/nf_conntrack_netlink.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

 note: compile tested only.

diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index 4e078cd..627b0e5 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2624,7 +2624,7 @@ ctnetlink_create_expect(struct net *net, u16 zone,
if (!help) {
if (!cda[CTA_EXPECT_TIMEOUT]) {
err = -EINVAL;
-   goto out;
+   goto err_out;
}
exp->timeout.expires =
  jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ;
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] rtlwifi: Don't leak on error in _rtl_usb_receive()

2012-12-26 Thread Jesper Juhl
We fail to release 'urb' if '_rtl_prep_rx_urb()' fails in
_rtl_usb_receive().
This patch should take care of the leak.

Signed-off-by: Jesper Juhl 
---
 drivers/net/wireless/rtlwifi/usb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

 note: compile tested only.

diff --git a/drivers/net/wireless/rtlwifi/usb.c 
b/drivers/net/wireless/rtlwifi/usb.c
index 29f0969..75c29e6 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -640,6 +640,7 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
 "Failed to prep_rx_urb!!\n");
err = PTR_ERR(skb);
+   usb_free_urb(urb);
goto err_out;
}
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [SCSI] csiostor: Don't leak mem or fail to release firmware in csio_hw_flash_config()

2012-12-26 Thread Jesper Juhl
If kzalloc() or csio_hw_check_fwconfig() fail we may leave the
csio_hw_flash_config() function without freeing allocated memory or
firmware. This should take care of the leaks.

Signed-off-by: Jesper Juhl 
---
 drivers/scsi/csiostor/csio_hw.c |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)

 Note: I'm unable to really test this, so the patch is compile tested
   only.

diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
index 8ecdb94..bdd78fb 100644
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -2131,13 +2131,16 @@ csio_hw_flash_config(struct csio_hw *hw, u32 
*fw_cfg_param, char *path)
value_to_add = 4 - (cf->size % 4);
 
cfg_data = kzalloc(cf->size+value_to_add, GFP_KERNEL);
-   if (cfg_data == NULL)
-   return -ENOMEM;
+   if (cfg_data == NULL) {
+   ret = -ENOMEM;
+   goto leave;
+   }
 
memcpy((void *)cfg_data, (const void *)cf->data, cf->size);
-
-   if (csio_hw_check_fwconfig(hw, fw_cfg_param) != 0)
-   return -EINVAL;
+   if (csio_hw_check_fwconfig(hw, fw_cfg_param) != 0) {
+   ret = -EINVAL;
+   goto leave;
+   }
 
mtype = FW_PARAMS_PARAM_Y_GET(*fw_cfg_param);
maddr = FW_PARAMS_PARAM_Z_GET(*fw_cfg_param) << 16;
@@ -2149,9 +2152,9 @@ csio_hw_flash_config(struct csio_hw *hw, u32 
*fw_cfg_param, char *path)
strncpy(path, "/lib/firmware/" CSIO_CF_FNAME, 64);
}
 
+leave:
kfree(cfg_data);
release_firmware(cf);
-
return ret;
 }
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [SCSI] csiostor: Don't leak mem or fail to release firmware in csio_hw_flash_config()

2012-12-26 Thread Jesper Juhl
If kzalloc() or csio_hw_check_fwconfig() fail we may leave the
csio_hw_flash_config() function without freeing allocated memory or
firmware. This should take care of the leaks.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/scsi/csiostor/csio_hw.c |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)

 Note: I'm unable to really test this, so the patch is compile tested
   only.

diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
index 8ecdb94..bdd78fb 100644
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -2131,13 +2131,16 @@ csio_hw_flash_config(struct csio_hw *hw, u32 
*fw_cfg_param, char *path)
value_to_add = 4 - (cf-size % 4);
 
cfg_data = kzalloc(cf-size+value_to_add, GFP_KERNEL);
-   if (cfg_data == NULL)
-   return -ENOMEM;
+   if (cfg_data == NULL) {
+   ret = -ENOMEM;
+   goto leave;
+   }
 
memcpy((void *)cfg_data, (const void *)cf-data, cf-size);
-
-   if (csio_hw_check_fwconfig(hw, fw_cfg_param) != 0)
-   return -EINVAL;
+   if (csio_hw_check_fwconfig(hw, fw_cfg_param) != 0) {
+   ret = -EINVAL;
+   goto leave;
+   }
 
mtype = FW_PARAMS_PARAM_Y_GET(*fw_cfg_param);
maddr = FW_PARAMS_PARAM_Z_GET(*fw_cfg_param)  16;
@@ -2149,9 +2152,9 @@ csio_hw_flash_config(struct csio_hw *hw, u32 
*fw_cfg_param, char *path)
strncpy(path, /lib/firmware/ CSIO_CF_FNAME, 64);
}
 
+leave:
kfree(cfg_data);
release_firmware(cf);
-
return ret;
 }
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] rtlwifi: Don't leak on error in _rtl_usb_receive()

2012-12-26 Thread Jesper Juhl
We fail to release 'urb' if '_rtl_prep_rx_urb()' fails in
_rtl_usb_receive().
This patch should take care of the leak.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/net/wireless/rtlwifi/usb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

 note: compile tested only.

diff --git a/drivers/net/wireless/rtlwifi/usb.c 
b/drivers/net/wireless/rtlwifi/usb.c
index 29f0969..75c29e6 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -640,6 +640,7 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
 Failed to prep_rx_urb!!\n);
err = PTR_ERR(skb);
+   usb_free_urb(urb);
goto err_out;
}
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] netfilter: Don't leak 'exp' in ctnetlink_create_expect()

2012-12-26 Thread Jesper Juhl
'if ((!help)  (!cda[CTA_EXPECT_TIMEOUT]))' then we should remember
to free 'exp' that was allocated by 'nf_ct_expect_alloc()' by jumping
to the 'err_out' label rather than the 'out' label in
ctnetlink_create_expect().
This patch should get rid of the leak.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 net/netfilter/nf_conntrack_netlink.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

 note: compile tested only.

diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index 4e078cd..627b0e5 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2624,7 +2624,7 @@ ctnetlink_create_expect(struct net *net, u16 zone,
if (!help) {
if (!cda[CTA_EXPECT_TIMEOUT]) {
err = -EINVAL;
-   goto out;
+   goto err_out;
}
exp-timeout.expires =
  jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ;
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [tip:x86/build] x86: Default to ARCH= x86 to avoid overriding CONFIG_64BIT

2012-12-26 Thread Jesper Juhl
On Wed, 26 Dec 2012, David Rientjes wrote:

 On Wed, 26 Dec 2012, David Woodhouse wrote:
 
   I'm sure it's a 32-bit issue, nothing has changed recently in auto-latest 
   related to these subsystems and I'm sure it's just because my randconfig 
   builds were exposed to this combination solely because of this patch.
  
  Hm, that's an unexpected benefit of this patch. I didn't think it would
  noticeably improve 'make randconfig' coverage of configs without
  CONFIG_64BIT, because I thought enough people were doing such tests
  already. But evidently I was wrong.
  
 
 I do quite a bit of automated config and boot tests to try out 
 combinations that others may not have tested when developing their code; 
 staging branches such as in tip are interesting to try because they 
 haven't yet reached Linus and it's helpful to catch breakages before it 
 reaches mainline.
 
  We introduced 'make randconfig' as a tool to generate meaningless
  configs just to test various permutations — to ensure that we got our
  dependencies right both in Kconfig and the code itself. It was
  artificially limiting its test coverage and thus we were failing to
  discover real bugs. Now I've fixed that problem, and 'make randconfig'
  is actually random and is thus doing its job even better than before.
  Yay!
  
 
 Umm, you're saying that is legitimate for make randconfig done on a 
 32-bit machine to generate 64-bit configurations?  The resulting kernel 
 cannot be booted.  In the past, make randconfig would always generate a 
 kernel that _should_ boot on that machine unless there was an underlying 
 bug that should be fixed.
 
...

Why would you assume a bootable kernel from 'randconfig'? I don't and 
never have. If we stick to X86, then you may get a kernel config without 
x387/emulator support - try to boot boot that on a 486sx. You may also get 
a config that does not contain the filesystem(s) you use, or without the 
driver for your main HD. You may also be out of luck with graphics 
drivers or support for your mouse/keyboard combo. etc etc.

In my view, randconfig was never about building bootable kernels, but all 
about building possible kernel config combinations - that may or may not 
boot on any given system.  The point was only to test that some 
combination of options did in fact build (if it also boots then all the 
better, but that was never part of the goal; as I saw it).

I may be wrong, but that was/is my expectations for 'randconfig'.

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


Re: [PATCH] kvm tools: remove unneeded checks in qcow code

2012-12-21 Thread Jesper Juhl
On Thu, 20 Dec 2012, Sasha Levin wrote:

> We already know q!=NULL at that point, no need to retest.
> 
Right, and even if it was ==NULL then 'free(NULL)' is guaranteed to be a 
NOP, so it would still be fine.

Reviewed-by: Jesper Juhl 


> Signed-off-by: Sasha Levin 
> ---
>  tools/kvm/disk/qcow.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c
> index ee2992e..64a2550 100644
> --- a/tools/kvm/disk/qcow.c
> +++ b/tools/kvm/disk/qcow.c
> @@ -1361,8 +1361,7 @@ free_header:
>   if (q->header)
>   free(q->header);
>  free_qcow:
> - if (q)
> - free(q);
> + free(q);
>  
>   return NULL;
>  }
> @@ -1492,8 +1491,7 @@ free_header:
>   if (q->header)
>   free(q->header);
>  free_qcow:
> -     if (q)
> - free(q);
> + free(q);
>  
>   return NULL;
>  }
> 

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] kvm tools: remove unneeded checks in qcow code

2012-12-21 Thread Jesper Juhl
On Thu, 20 Dec 2012, Sasha Levin wrote:

 We already know q!=NULL at that point, no need to retest.
 
Right, and even if it was ==NULL then 'free(NULL)' is guaranteed to be a 
NOP, so it would still be fine.

Reviewed-by: Jesper Juhl j...@chaosbits.net


 Signed-off-by: Sasha Levin sasha.le...@oracle.com
 ---
  tools/kvm/disk/qcow.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)
 
 diff --git a/tools/kvm/disk/qcow.c b/tools/kvm/disk/qcow.c
 index ee2992e..64a2550 100644
 --- a/tools/kvm/disk/qcow.c
 +++ b/tools/kvm/disk/qcow.c
 @@ -1361,8 +1361,7 @@ free_header:
   if (q-header)
   free(q-header);
  free_qcow:
 - if (q)
 - free(q);
 + free(q);
  
   return NULL;
  }
 @@ -1492,8 +1491,7 @@ free_header:
   if (q-header)
   free(q-header);
  free_qcow:
 - if (q)
 - free(q);
 + free(q);
  
   return NULL;
  }
 

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH/TRIVIAL] blackfin: time-ts: Remove duplicate assignment

2012-12-18 Thread Jesper Juhl
On Tue, 18 Dec 2012, Stephen Boyd wrote:

> It seems that this assignment is done twice in a row. Remove the
> duplicate assignment.
> 
> Signed-off-by: Stephen Boyd 
> Cc: Steven Miao 
> Cc: triv...@kernel.org
> ---
> 
> Noticed while grepping for broadcast users.
> 
>  arch/blackfin/kernel/time-ts.c | 6 --
>  1 file changed, 6 deletions(-)
> 
> diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
> index f608f02..cb0a484 100644
> --- a/arch/blackfin/kernel/time-ts.c
> +++ b/arch/blackfin/kernel/time-ts.c
> @@ -329,12 +329,6 @@ void bfin_coretmr_clockevent_init(void)
>   evt->broadcast = smp_timer_broadcast;
>  #endif
>  
> -
> -#ifdef CONFIG_SMP
> - evt->broadcast = smp_timer_broadcast;
> -#endif
> -
> -
>   evt->name = "bfin_core_timer";
>   evt->rating = 350;
>   evt->irq = -1;
> 

Looks good to me.

Feel free to add
  Reviewed-by: Jesper Juhl 
if you like.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][resend] MMC, vub300: Resolve mem leak in vub300_probe() and simplify the code a bit

2012-12-18 Thread Jesper Juhl
In drivers/mmc/host/vub300.c::vub300_probe() we need both
'command_out_urb' and 'command_res_urb'. Currently we fail to free the
former if allocating the latter fails. Fix that and simplify the code
a bit at the same time by just doing both allocations and if either
fails then free both - usb_free_urb() deals gracefully with NULL
pointers, so this is safe.

We also initialize 'retval' to '-ENOMEM' when we declare the variable,
so there's no reason to re-set it to '-ENOMEM' before jumping to
'error0:' when one of the initial usb_alloc_urb() calls fail().

Also rename the 'error[0145]:' labels to be just 'error0' and
'error1'.

Signed-off-by: Jesper Juhl 
---
 drivers/mmc/host/vub300.c |   29 +++--
 1 files changed, 11 insertions(+), 18 deletions(-)

 This is a resend. I originally submitted this back in January: 
 http://lkml.indiana.edu/hypermail/linux/kernel/1201.3/00305.html
 but got no response.

 Note:
 I have no real way to actually test this patch, so it is compile tested
 only. Please review carefully before applying.
 Also please keep me on Cc: when replying.

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index cb9f361..3f59fe1 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -2116,23 +2116,18 @@ static int vub300_probe(struct usb_interface *interface,
 udev->descriptor.idVendor, udev->descriptor.idProduct,
 manufacturer, product, serial_number);
command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!command_out_urb) {
-   retval = -ENOMEM;
-   dev_err(>dev, "not enough memory for command_out_urb\n");
-   goto error0;
-   }
command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!command_res_urb) {
+   if (!command_res_urb || !command_out_urb) {
retval = -ENOMEM;
-   dev_err(>dev, "not enough memory for command_res_urb\n");
-   goto error1;
+   dev_err(>dev, "not enough memory for command urbs\n");
+   goto error0;
}
/* this also allocates memory for our VUB300 mmc host device */
mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), >dev);
if (!mmc) {
retval = -ENOMEM;
dev_err(>dev, "not enough memory for the mmc_host\n");
-   goto error4;
+   goto error0;
}
/* MMC core transfer sizes tunable parameters */
mmc->caps = 0;
@@ -2285,7 +2280,7 @@ static int vub300_probe(struct usb_interface *interface,
dev_err(>udev->dev,
"Could not find two sets of bulk-in/out endpoint pairs\n");
retval = -EINVAL;
-   goto error5;
+   goto error1;
}
retval =
usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
@@ -2294,14 +2289,14 @@ static int vub300_probe(struct usb_interface *interface,
0x, 0x, >hc_info,
sizeof(vub300->hc_info), HZ);
if (retval < 0)
-   goto error5;
+   goto error1;
retval =
usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
SET_ROM_WAIT_STATES,
USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
firmware_rom_wait_states, 0x, NULL, 0, HZ);
if (retval < 0)
-   goto error5;
+   goto error1;
dev_info(>udev->dev,
 "operating_mode = %s %s %d MHz %s %d byte USB packets\n",
 (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
@@ -2316,14 +2311,14 @@ static int vub300_probe(struct usb_interface *interface,
0x, 0x, >system_port_status,
sizeof(vub300->system_port_status), HZ);
if (retval < 0) {
-   goto error4;
+   goto error0;
} else if (sizeof(vub300->system_port_status) == retval) {
vub300->card_present =
(0x0001 & vub300->system_port_status.port_flags) ? 1 : 
0;
vub300->read_only =
(0x0010 & vub300->system_port_status.port_flags) ? 1 : 
0;
} else {
-   goto error4;
+   goto error0;
}
usb_set_intfdata(interface, vub300);
INIT_DELAYED_WORK(>pollwork, vub300_pollwork_thread);
@@ -2351,17 +2346,15 @@ static int vub300_probe(struct usb_interface *interface,
 interface_to_InterfaceNumber(interface));
mmc_add_host(mmc);
return 0;
-error5:
+error1:
mmc_free_host(mmc);

[PATCH] bq2415x_charger: Remove unneeded version.h include

2012-12-18 Thread Jesper Juhl
The file uses nothing from the header, so including it is pointless.

Signed-off-by: Jesper Juhl 
---
 drivers/power/bq2415x_charger.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index ee842b3..2d1b568 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -28,7 +28,6 @@
  * http://www.ti.com/product/bq24155
  */
 
-#include 
 #include 
 #include 
 #include 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] net: mvneta: remove unneeded version.h include

2012-12-18 Thread Jesper Juhl
The file uses nothing from the version.h header, so there is no reason
to include it.

Signed-off-by: Jesper Juhl 
---
 drivers/net/ethernet/marvell/mvneta.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c 
b/drivers/net/ethernet/marvell/mvneta.c
index 3f8086b..a1e0e9f 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -12,7 +12,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] atkbd: Fix multi-char scancode handling on reconnect.

2012-12-18 Thread Jesper Juhl
On Fri, 14 Dec 2012, Shawn Nematbakhsh wrote:

> On resume from suspend there is a possibility for multi-byte scancodes
> to be handled incorrectly. atkbd_reconnect disables the processing of
> scancodes in software by calling atkbd_disable, but the keyboard may
> still be active because no disconnect command was sent. Later, software
> handling is re-enabled. If a multi-byte scancode sent from the keyboard
> straddles the re-enable, only the latter byte(s) will be handled.
> 
> In practice, this leads to cases where multi-byte break codes (ex. "e0
> 4d" - break code for right-arrow) are misread as make codes ("4d" - make
> code for numeric 6), leading to one or more unwanted, untyped characters
> being interpreted.
> 
> The solution implemented here involves sending command f5 (reset
> disable) to the keyboard prior to disabling software handling of codes.
> Later, the command to re-enable the keyboard is sent only after we are
> prepared to handle scancodes.
> 
> Signed-off-by: Shawn Nematbakhsh 
> ---
>  drivers/input/keyboard/atkbd.c |   26 --
>  1 files changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
> index add5ffd..da49e8b 100644
> --- a/drivers/input/keyboard/atkbd.c
> +++ b/drivers/input/keyboard/atkbd.c
> @@ -844,6 +844,24 @@ static int atkbd_activate(struct atkbd *atkbd)
>  }
>  
>  /*
> + * atkbd_deactivate() resets and disables the keyboard from sending
> + * keystrokes.
> + */
> +static int atkbd_deactivate(struct atkbd *atkbd)

Why bother with a return type when you never check it anyway?
I'd say, either check for the 0/-1 you return and do something sensible or 
just let it return void.

> +{
> + struct ps2dev *ps2dev = >ps2dev;
> +
> + if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_DIS)) {
> + dev_err(>serio->dev,
> + "Failed to deactivate keyboard on %s\n",
> + ps2dev->serio->phys);
> + return -1;
> + }
> +
> + return 0;
> +}
> +
> +/*
>   * atkbd_cleanup() restores the keyboard state so that BIOS is happy after a
>   * reboot.
>   */
> @@ -1199,6 +1217,9 @@ static int atkbd_reconnect(struct serio *serio)
>  
>   mutex_lock(>mutex);
>  
> + if (atkbd->write)
> + atkbd_deactivate(atkbd);
> +
>   atkbd_disable(atkbd);
>  
>   if (atkbd->write) {
> @@ -1208,8 +1229,6 @@ static int atkbd_reconnect(struct serio *serio)
>   if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, 
> atkbd->extra))
>   goto out;
>  
> - atkbd_activate(atkbd);
> -
>   /*
>* Restore LED state and repeat rate. While input core
>* will do this for us at resume time reconnect may happen
> @@ -1224,6 +1243,9 @@ static int atkbd_reconnect(struct serio *serio)
>   }
>  
>   atkbd_enable(atkbd);
> + if (atkbd->write)
> + atkbd_activate(atkbd);
> +
>   retval = 0;
>  
>   out:
> 

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] atkbd: Fix multi-char scancode handling on reconnect.

2012-12-18 Thread Jesper Juhl
On Fri, 14 Dec 2012, Shawn Nematbakhsh wrote:

 On resume from suspend there is a possibility for multi-byte scancodes
 to be handled incorrectly. atkbd_reconnect disables the processing of
 scancodes in software by calling atkbd_disable, but the keyboard may
 still be active because no disconnect command was sent. Later, software
 handling is re-enabled. If a multi-byte scancode sent from the keyboard
 straddles the re-enable, only the latter byte(s) will be handled.
 
 In practice, this leads to cases where multi-byte break codes (ex. e0
 4d - break code for right-arrow) are misread as make codes (4d - make
 code for numeric 6), leading to one or more unwanted, untyped characters
 being interpreted.
 
 The solution implemented here involves sending command f5 (reset
 disable) to the keyboard prior to disabling software handling of codes.
 Later, the command to re-enable the keyboard is sent only after we are
 prepared to handle scancodes.
 
 Signed-off-by: Shawn Nematbakhsh sha...@chromium.org
 ---
  drivers/input/keyboard/atkbd.c |   26 --
  1 files changed, 24 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
 index add5ffd..da49e8b 100644
 --- a/drivers/input/keyboard/atkbd.c
 +++ b/drivers/input/keyboard/atkbd.c
 @@ -844,6 +844,24 @@ static int atkbd_activate(struct atkbd *atkbd)
  }
  
  /*
 + * atkbd_deactivate() resets and disables the keyboard from sending
 + * keystrokes.
 + */
 +static int atkbd_deactivate(struct atkbd *atkbd)

Why bother with a return type when you never check it anyway?
I'd say, either check for the 0/-1 you return and do something sensible or 
just let it return void.

 +{
 + struct ps2dev *ps2dev = atkbd-ps2dev;
 +
 + if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_DIS)) {
 + dev_err(ps2dev-serio-dev,
 + Failed to deactivate keyboard on %s\n,
 + ps2dev-serio-phys);
 + return -1;
 + }
 +
 + return 0;
 +}
 +
 +/*
   * atkbd_cleanup() restores the keyboard state so that BIOS is happy after a
   * reboot.
   */
 @@ -1199,6 +1217,9 @@ static int atkbd_reconnect(struct serio *serio)
  
   mutex_lock(atkbd-mutex);
  
 + if (atkbd-write)
 + atkbd_deactivate(atkbd);
 +
   atkbd_disable(atkbd);
  
   if (atkbd-write) {
 @@ -1208,8 +1229,6 @@ static int atkbd_reconnect(struct serio *serio)
   if (atkbd-set != atkbd_select_set(atkbd, atkbd-set, 
 atkbd-extra))
   goto out;
  
 - atkbd_activate(atkbd);
 -
   /*
* Restore LED state and repeat rate. While input core
* will do this for us at resume time reconnect may happen
 @@ -1224,6 +1243,9 @@ static int atkbd_reconnect(struct serio *serio)
   }
  
   atkbd_enable(atkbd);
 + if (atkbd-write)
 + atkbd_activate(atkbd);
 +
   retval = 0;
  
   out:
 

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] net: mvneta: remove unneeded version.h include

2012-12-18 Thread Jesper Juhl
The file uses nothing from the version.h header, so there is no reason
to include it.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/net/ethernet/marvell/mvneta.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c 
b/drivers/net/ethernet/marvell/mvneta.c
index 3f8086b..a1e0e9f 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -12,7 +12,6 @@
  */
 
 #include linux/kernel.h
-#include linux/version.h
 #include linux/netdevice.h
 #include linux/etherdevice.h
 #include linux/platform_device.h
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] bq2415x_charger: Remove unneeded version.h include

2012-12-18 Thread Jesper Juhl
The file uses nothing from the header, so including it is pointless.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/power/bq2415x_charger.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
index ee842b3..2d1b568 100644
--- a/drivers/power/bq2415x_charger.c
+++ b/drivers/power/bq2415x_charger.c
@@ -28,7 +28,6 @@
  * http://www.ti.com/product/bq24155
  */
 
-#include linux/version.h
 #include linux/kernel.h
 #include linux/module.h
 #include linux/param.h
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][resend] MMC, vub300: Resolve mem leak in vub300_probe() and simplify the code a bit

2012-12-18 Thread Jesper Juhl
In drivers/mmc/host/vub300.c::vub300_probe() we need both
'command_out_urb' and 'command_res_urb'. Currently we fail to free the
former if allocating the latter fails. Fix that and simplify the code
a bit at the same time by just doing both allocations and if either
fails then free both - usb_free_urb() deals gracefully with NULL
pointers, so this is safe.

We also initialize 'retval' to '-ENOMEM' when we declare the variable,
so there's no reason to re-set it to '-ENOMEM' before jumping to
'error0:' when one of the initial usb_alloc_urb() calls fail().

Also rename the 'error[0145]:' labels to be just 'error0' and
'error1'.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/mmc/host/vub300.c |   29 +++--
 1 files changed, 11 insertions(+), 18 deletions(-)

 This is a resend. I originally submitted this back in January: 
 http://lkml.indiana.edu/hypermail/linux/kernel/1201.3/00305.html
 but got no response.

 Note:
 I have no real way to actually test this patch, so it is compile tested
 only. Please review carefully before applying.
 Also please keep me on Cc: when replying.

diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index cb9f361..3f59fe1 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -2116,23 +2116,18 @@ static int vub300_probe(struct usb_interface *interface,
 udev-descriptor.idVendor, udev-descriptor.idProduct,
 manufacturer, product, serial_number);
command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!command_out_urb) {
-   retval = -ENOMEM;
-   dev_err(udev-dev, not enough memory for command_out_urb\n);
-   goto error0;
-   }
command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
-   if (!command_res_urb) {
+   if (!command_res_urb || !command_out_urb) {
retval = -ENOMEM;
-   dev_err(udev-dev, not enough memory for command_res_urb\n);
-   goto error1;
+   dev_err(udev-dev, not enough memory for command urbs\n);
+   goto error0;
}
/* this also allocates memory for our VUB300 mmc host device */
mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), udev-dev);
if (!mmc) {
retval = -ENOMEM;
dev_err(udev-dev, not enough memory for the mmc_host\n);
-   goto error4;
+   goto error0;
}
/* MMC core transfer sizes tunable parameters */
mmc-caps = 0;
@@ -2285,7 +2280,7 @@ static int vub300_probe(struct usb_interface *interface,
dev_err(vub300-udev-dev,
Could not find two sets of bulk-in/out endpoint pairs\n);
retval = -EINVAL;
-   goto error5;
+   goto error1;
}
retval =
usb_control_msg(vub300-udev, usb_rcvctrlpipe(vub300-udev, 0),
@@ -2294,14 +2289,14 @@ static int vub300_probe(struct usb_interface *interface,
0x, 0x, vub300-hc_info,
sizeof(vub300-hc_info), HZ);
if (retval  0)
-   goto error5;
+   goto error1;
retval =
usb_control_msg(vub300-udev, usb_rcvctrlpipe(vub300-udev, 0),
SET_ROM_WAIT_STATES,
USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
firmware_rom_wait_states, 0x, NULL, 0, HZ);
if (retval  0)
-   goto error5;
+   goto error1;
dev_info(vub300-udev-dev,
 operating_mode = %s %s %d MHz %s %d byte USB packets\n,
 (mmc-caps  MMC_CAP_SDIO_IRQ) ? IRQs : POLL,
@@ -2316,14 +2311,14 @@ static int vub300_probe(struct usb_interface *interface,
0x, 0x, vub300-system_port_status,
sizeof(vub300-system_port_status), HZ);
if (retval  0) {
-   goto error4;
+   goto error0;
} else if (sizeof(vub300-system_port_status) == retval) {
vub300-card_present =
(0x0001  vub300-system_port_status.port_flags) ? 1 : 
0;
vub300-read_only =
(0x0010  vub300-system_port_status.port_flags) ? 1 : 
0;
} else {
-   goto error4;
+   goto error0;
}
usb_set_intfdata(interface, vub300);
INIT_DELAYED_WORK(vub300-pollwork, vub300_pollwork_thread);
@@ -2351,17 +2346,15 @@ static int vub300_probe(struct usb_interface *interface,
 interface_to_InterfaceNumber(interface));
mmc_add_host(mmc);
return 0;
-error5:
+error1:
mmc_free_host(mmc);
/*
 * and hence also frees vub300
 * which is contained at the end of struct mmc
 */
-error4:
+error0:
usb_free_urb

Re: [PATCH/TRIVIAL] blackfin: time-ts: Remove duplicate assignment

2012-12-18 Thread Jesper Juhl
On Tue, 18 Dec 2012, Stephen Boyd wrote:

 It seems that this assignment is done twice in a row. Remove the
 duplicate assignment.
 
 Signed-off-by: Stephen Boyd sb...@codeaurora.org
 Cc: Steven Miao real...@gmail.com
 Cc: triv...@kernel.org
 ---
 
 Noticed while grepping for broadcast users.
 
  arch/blackfin/kernel/time-ts.c | 6 --
  1 file changed, 6 deletions(-)
 
 diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
 index f608f02..cb0a484 100644
 --- a/arch/blackfin/kernel/time-ts.c
 +++ b/arch/blackfin/kernel/time-ts.c
 @@ -329,12 +329,6 @@ void bfin_coretmr_clockevent_init(void)
   evt-broadcast = smp_timer_broadcast;
  #endif
  
 -
 -#ifdef CONFIG_SMP
 - evt-broadcast = smp_timer_broadcast;
 -#endif
 -
 -
   evt-name = bfin_core_timer;
   evt-rating = 350;
   evt-irq = -1;
 

Looks good to me.

Feel free to add
  Reviewed-by: Jesper Juhl j...@chaosbits.net
if you like.

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Remove unnecessary declarations from Documentation/accounting/getdelays.c

2012-11-25 Thread Jesper Juhl
On Sat, 24 Nov 2012, Anthony G. Basile wrote:

> From: "Anthony G. Basile" 
> 
> stime and utime are declared __u64 but are never used.  On a glibc system
> this is harmless lint, but on a uClibc system, because of the difference
> in they way header files stack, including stdio.h brings in time.h and
> this causes a name collision with stime.  Since these are useless anyhow,
> we remove them.
> 
> Signed-off-by: Anthony G. Basile 
> ---
>  Documentation/accounting/getdelays.c |1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/accounting/getdelays.c 
> b/Documentation/accounting/getdelays.c
> index 6f706ac..f8ebcde 100644
> --- a/Documentation/accounting/getdelays.c
> +++ b/Documentation/accounting/getdelays.c
> @@ -51,7 +51,6 @@ int dbg;
>  int print_delays;
>  int print_io_accounting;
>  int print_task_context_switch_counts;
> -__u64 stime, utime;
>  
>  #define PRINTF(fmt, arg...) {\
>   if (dbg) {  \
> 

Seems fine to me...

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Remove unnecessary declarations from Documentation/accounting/getdelays.c

2012-11-25 Thread Jesper Juhl
On Sat, 24 Nov 2012, Anthony G. Basile wrote:

 From: Anthony G. Basile bas...@opensource.dyc.edu
 
 stime and utime are declared __u64 but are never used.  On a glibc system
 this is harmless lint, but on a uClibc system, because of the difference
 in they way header files stack, including stdio.h brings in time.h and
 this causes a name collision with stime.  Since these are useless anyhow,
 we remove them.
 
 Signed-off-by: Anthony G. Basile bas...@opensource.dyc.edu
 ---
  Documentation/accounting/getdelays.c |1 -
  1 files changed, 0 insertions(+), 1 deletions(-)
 
 diff --git a/Documentation/accounting/getdelays.c 
 b/Documentation/accounting/getdelays.c
 index 6f706ac..f8ebcde 100644
 --- a/Documentation/accounting/getdelays.c
 +++ b/Documentation/accounting/getdelays.c
 @@ -51,7 +51,6 @@ int dbg;
  int print_delays;
  int print_io_accounting;
  int print_task_context_switch_counts;
 -__u64 stime, utime;
  
  #define PRINTF(fmt, arg...) {\
   if (dbg) {  \
 

Seems fine to me...

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] [media] rc: Fix double free in gpio_ir_recv_remove()

2012-10-28 Thread Jesper Juhl
Since rc_unregister_device() frees its argument there's no need to
subsequently call rc_free_device() on the same variable - in fact it's
a double free bug.
Easily fixed by just removing the rc_free_device() call.

Signed-off-by: Jesper Juhl 
---
 drivers/media/rc/gpio-ir-recv.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index c698408..fe0941d 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -148,7 +148,6 @@ static int __devexit gpio_ir_recv_remove(struct 
platform_device *pdev)
platform_set_drvdata(pdev, NULL);
rc_unregister_device(gpio_dev->rcdev);
gpio_free(gpio_dev->gpio_nr);
-   rc_free_device(gpio_dev->rcdev);
kfree(gpio_dev);
return 0;
 }
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] [media] rc: Fix double free in gpio_ir_recv_probe()

2012-10-28 Thread Jesper Juhl
At the 'err_request_irq' label, rc_unregister_device(rcdev) frees its
argument. So when we fall through to the 'err_gpio_request' label
further down and call rc_free_device(rcdev) then that's a double free.

Fix that by moving 'rcdev = NULL' from after the call to
rc_free_device() to after rc_unregister_device(). That fixes the
problem since rc_free_device() just does nothing if passed NULL and
there's no further use of 'rcdev' after the call to rc_free_device()
so it's not needed there.

Signed-off-by: Jesper Juhl 
---
 drivers/media/rc/gpio-ir-recv.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 04cb272..c698408 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -129,12 +129,12 @@ static int __devinit gpio_ir_recv_probe(struct 
platform_device *pdev)
 err_request_irq:
platform_set_drvdata(pdev, NULL);
rc_unregister_device(rcdev);
+   rcdev = NULL;
 err_register_rc_device:
 err_gpio_direction_input:
gpio_free(pdata->gpio_nr);
 err_gpio_request:
rc_free_device(rcdev);
-   rcdev = NULL;
 err_allocate_device:
kfree(gpio_dev);
return rc;
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ACPICA: Don't leak next_walk_state in acpi_ds_call_control_method()

2012-10-28 Thread Jesper Juhl
On Thu, 25 Oct 2012, Rafael J. Wysocki wrote:

> On Sunday 21 of October 2012 22:35:46 Jesper Juhl wrote:
> > If acpi_ds_create_walk_state() succeeds, but the call to
> > ACPI_ALLOCATE_ZEROED() fails, then we'll return from the function
> > without properly freeing 'next_walk_state'.
> > 
> > Signed-off-by: Jesper Juhl 
> 
> This has to go through ACPICA upstream, but we'll get it from there 
> eventually.
> 

Ok. I haven't heard any response to this other than yours, so I guess I'll 
just re-send it in a few days if I still hear nothing.

Can I add your ACK when I re-send?

/Jesper


> Thanks,
> Rafael
> 
> 
> > ---
> >  drivers/acpi/acpica/dsmethod.c |3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
> > index aa9a5d4..ade59a3 100644
> > --- a/drivers/acpi/acpica/dsmethod.c
> > +++ b/drivers/acpi/acpica/dsmethod.c
> > @@ -378,7 +378,8 @@ acpi_ds_call_control_method(struct acpi_thread_state 
> > *thread,
> >  */
> > info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
> > if (!info) {
> > -   return_ACPI_STATUS(AE_NO_MEMORY);
> > +   status = AE_NO_MEMORY;
> > +   goto cleanup;
> > }
> >  
> > info->parameters = _walk_state->operands[0];
> > 
> 

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ACPICA: Don't leak next_walk_state in acpi_ds_call_control_method()

2012-10-28 Thread Jesper Juhl
On Thu, 25 Oct 2012, Rafael J. Wysocki wrote:

 On Sunday 21 of October 2012 22:35:46 Jesper Juhl wrote:
  If acpi_ds_create_walk_state() succeeds, but the call to
  ACPI_ALLOCATE_ZEROED() fails, then we'll return from the function
  without properly freeing 'next_walk_state'.
  
  Signed-off-by: Jesper Juhl j...@chaosbits.net
 
 This has to go through ACPICA upstream, but we'll get it from there 
 eventually.
 

Ok. I haven't heard any response to this other than yours, so I guess I'll 
just re-send it in a few days if I still hear nothing.

Can I add your ACK when I re-send?

/Jesper


 Thanks,
 Rafael
 
 
  ---
   drivers/acpi/acpica/dsmethod.c |3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)
  
  diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
  index aa9a5d4..ade59a3 100644
  --- a/drivers/acpi/acpica/dsmethod.c
  +++ b/drivers/acpi/acpica/dsmethod.c
  @@ -378,7 +378,8 @@ acpi_ds_call_control_method(struct acpi_thread_state 
  *thread,
   */
  info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
  if (!info) {
  -   return_ACPI_STATUS(AE_NO_MEMORY);
  +   status = AE_NO_MEMORY;
  +   goto cleanup;
  }
   
  info-parameters = this_walk_state-operands[0];
  
 

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] [media] rc: Fix double free in gpio_ir_recv_probe()

2012-10-28 Thread Jesper Juhl
At the 'err_request_irq' label, rc_unregister_device(rcdev) frees its
argument. So when we fall through to the 'err_gpio_request' label
further down and call rc_free_device(rcdev) then that's a double free.

Fix that by moving 'rcdev = NULL' from after the call to
rc_free_device() to after rc_unregister_device(). That fixes the
problem since rc_free_device() just does nothing if passed NULL and
there's no further use of 'rcdev' after the call to rc_free_device()
so it's not needed there.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/rc/gpio-ir-recv.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 04cb272..c698408 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -129,12 +129,12 @@ static int __devinit gpio_ir_recv_probe(struct 
platform_device *pdev)
 err_request_irq:
platform_set_drvdata(pdev, NULL);
rc_unregister_device(rcdev);
+   rcdev = NULL;
 err_register_rc_device:
 err_gpio_direction_input:
gpio_free(pdata-gpio_nr);
 err_gpio_request:
rc_free_device(rcdev);
-   rcdev = NULL;
 err_allocate_device:
kfree(gpio_dev);
return rc;
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] [media] rc: Fix double free in gpio_ir_recv_remove()

2012-10-28 Thread Jesper Juhl
Since rc_unregister_device() frees its argument there's no need to
subsequently call rc_free_device() on the same variable - in fact it's
a double free bug.
Easily fixed by just removing the rc_free_device() call.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/rc/gpio-ir-recv.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index c698408..fe0941d 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -148,7 +148,6 @@ static int __devexit gpio_ir_recv_remove(struct 
platform_device *pdev)
platform_set_drvdata(pdev, NULL);
rc_unregister_device(gpio_dev-rcdev);
gpio_free(gpio_dev-gpio_nr);
-   rc_free_device(gpio_dev-rcdev);
kfree(gpio_dev);
return 0;
 }
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: csr: remove a number of unneeded includes of version.h

2012-10-23 Thread Jesper Juhl
On Mon, 22 Oct 2012, Greg Kroah-Hartman wrote:

> On Thu, Oct 18, 2012 at 09:51:56PM +0200, Jesper Juhl wrote:
> > 
> > Signed-off-by: Jesper Juhl 
> 
> Someone already beat you to this patch, sorry.
> 
Heh. That happens - no problem - as long as it gets fixed :)


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: csr: remove a number of unneeded includes of version.h

2012-10-23 Thread Jesper Juhl
On Mon, 22 Oct 2012, Greg Kroah-Hartman wrote:

 On Thu, Oct 18, 2012 at 09:51:56PM +0200, Jesper Juhl wrote:
  
  Signed-off-by: Jesper Juhl j...@chaosbits.net
 
 Someone already beat you to this patch, sorry.
 
Heh. That happens - no problem - as long as it gets fixed :)


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ACPICA: Don't leak next_walk_state in acpi_ds_call_control_method()

2012-10-21 Thread Jesper Juhl
If acpi_ds_create_walk_state() succeeds, but the call to
ACPI_ALLOCATE_ZEROED() fails, then we'll return from the function
without properly freeing 'next_walk_state'.

Signed-off-by: Jesper Juhl 
---
 drivers/acpi/acpica/dsmethod.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index aa9a5d4..ade59a3 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -378,7 +378,8 @@ acpi_ds_call_control_method(struct acpi_thread_state 
*thread,
 */
info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
if (!info) {
-   return_ACPI_STATUS(AE_NO_MEMORY);
+   status = AE_NO_MEMORY;
+   goto cleanup;
}
 
info->parameters = _walk_state->operands[0];
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ACPICA: Don't leak next_walk_state in acpi_ds_call_control_method()

2012-10-21 Thread Jesper Juhl
If acpi_ds_create_walk_state() succeeds, but the call to
ACPI_ALLOCATE_ZEROED() fails, then we'll return from the function
without properly freeing 'next_walk_state'.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/acpi/acpica/dsmethod.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index aa9a5d4..ade59a3 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -378,7 +378,8 @@ acpi_ds_call_control_method(struct acpi_thread_state 
*thread,
 */
info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
if (!info) {
-   return_ACPI_STATUS(AE_NO_MEMORY);
+   status = AE_NO_MEMORY;
+   goto cleanup;
}
 
info-parameters = this_walk_state-operands[0];
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] Documentation DMA-API-HOWTO.txt Add dma mapping error check usage examples

2012-10-18 Thread Jesper Juhl
On Thu, 18 Oct 2012, Shuah Khan wrote:

> Enhance the document to discuss the importance of dma mapping error checks
> after dma_map_single() and dma_map_page() calls. Also added usage examples
> that include unmap examples in error paths when dma mapping error is returned.
> Includes correct and incorrect usages to high light some common mistakes in
> error paths especially when dma mapping fails when more than one dma mapping
> call is made.
> 
> Signed-off-by: Shuah Khan 
[...]

Nit picking :

> +Example 2: (if buffers are allocated a loop, unmap all mapped buffers when
> + mapping error is detected in the middle)
> +

"... if buffers are allocated in a loop..."

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: csr: remove a number of unneeded includes of version.h

2012-10-18 Thread Jesper Juhl

Signed-off-by: Jesper Juhl 
---
 drivers/staging/csr/csr_framework_ext.c|1 -
 drivers/staging/csr/csr_time.c |1 -
 drivers/staging/csr/io.c   |1 -
 drivers/staging/csr/monitor.c  |1 -
 drivers/staging/csr/netdev.c   |1 -
 drivers/staging/csr/sdio_mmc.c |1 -
 drivers/staging/csr/sme_native.c   |1 -
 drivers/staging/csr/sme_sys.c  |1 -
 drivers/staging/csr/ul_int.c   |1 -
 drivers/staging/csr/unifi_pdu_processing.c |1 -
 drivers/staging/csr/unifi_priv.h   |1 -
 drivers/staging/csr/unifi_wext.h   |1 -
 12 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/csr/csr_framework_ext.c 
b/drivers/staging/csr/csr_framework_ext.c
index f91a4bf..e203f60 100644
--- a/drivers/staging/csr/csr_framework_ext.c
+++ b/drivers/staging/csr/csr_framework_ext.c
@@ -9,7 +9,6 @@
 */
 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c
index 7b597f7..f4ff98c 100644
--- a/drivers/staging/csr/csr_time.c
+++ b/drivers/staging/csr/csr_time.c
@@ -9,7 +9,6 @@
 */
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c
index caf48e3..5206cba 100644
--- a/drivers/staging/csr/io.c
+++ b/drivers/staging/csr/io.c
@@ -31,7 +31,6 @@
  * ---
  */
 #include 
-#include 
 
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_unifiversion.h"
diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c
index 7c524a1..7b76f07 100644
--- a/drivers/staging/csr/monitor.c
+++ b/drivers/staging/csr/monitor.c
@@ -10,7 +10,6 @@
  * ---
  */
 
-#include 
 #include "unifi_priv.h"
 
 #ifdef UNIFI_SNIFF_ARPHRD
diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c
index 9a52ab4..8a53171 100644
--- a/drivers/staging/csr/netdev.c
+++ b/drivers/staging/csr/netdev.c
@@ -47,7 +47,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_conversions.h"
diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c
index af3e40b..6b96df1 100644
--- a/drivers/staging/csr/sdio_mmc.c
+++ b/drivers/staging/csr/sdio_mmc.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c
index d7a5125..26f10bc 100644
--- a/drivers/staging/csr/sme_native.c
+++ b/drivers/staging/csr/sme_native.c
@@ -12,7 +12,6 @@
  */
 
 #include 
-#include 
 #include "unifi_priv.h"
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_conversions.h"
diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c
index 5b26c41..90a30dc 100644
--- a/drivers/staging/csr/sme_sys.c
+++ b/drivers/staging/csr/sme_sys.c
@@ -14,7 +14,6 @@
  * ---
  */
 
-#include 
 #include "csr_wifi_hip_unifiversion.h"
 #include "unifi_priv.h"
 #include "csr_wifi_hip_conversions.h"
diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c
index 4013d02..0fae6f4 100644
--- a/drivers/staging/csr/ul_int.c
+++ b/drivers/staging/csr/ul_int.c
@@ -12,7 +12,6 @@
  *
  * ***
  */
-#include 
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_conversions.h"
 #include "unifi_priv.h"
diff --git a/drivers/staging/csr/unifi_pdu_processing.c 
b/drivers/staging/csr/unifi_pdu_processing.c
index ae7c8fc..a762939 100644
--- a/drivers/staging/csr/unifi_pdu_processing.c
+++ b/drivers/staging/csr/unifi_pdu_processing.c
@@ -14,7 +14,6 @@
  * ---
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h
index aec8e28..f25b92a 100644
--- a/drivers/staging/csr/unifi_priv.h
+++ b/drivers/staging/csr/unifi_priv.h
@@ -17,7 +17,6 @@
 #ifndef __LINUX_UNIFI_PRIV_H__
 #define __LINUX_UNIFI_PRIV_H__ 1
 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/csr/unifi_wext.h b/drivers/staging/csr/unifi_wext.h
index 6834c43..beba089 100644
--- a/drivers/staging/csr/unifi_wext.h
+++ b/drivers/staging/csr/unifi_wext.h
@@ -16,7 +16,6 @@
 #define __LINUX_UNIFI_WEXT_H__ 1
 
 #include 
-#include 
 #include 
 #include "csr_wifi_sme_prim.h"
 
-- 

[PATCH] Staging: silicom: Fix up version.h includes

2012-10-18 Thread Jesper Juhl
drivers/staging/silicom/bypasslib/bplibk.h actually uses stuff from
version.h so it should include the header.
drivers/staging/silicom/bp_proc.c and
drivers/staging/silicom/bypasslib/bypass.c currently include the
header but use nothing from it so they don't need to.

Signed-off-by: Jesper Juhl 
---
 drivers/staging/silicom/bp_proc.c  |1 -
 drivers/staging/silicom/bypasslib/bplibk.h |1 +
 drivers/staging/silicom/bypasslib/bypass.c |1 -
 3 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/silicom/bp_proc.c 
b/drivers/staging/silicom/bp_proc.c
index 6ad4b27..32799c7 100644
--- a/drivers/staging/silicom/bp_proc.c
+++ b/drivers/staging/silicom/bp_proc.c
@@ -10,7 +10,6 @@
 /*
*/
 
/**/
 
-#include 
 #if defined(CONFIG_SMP) && ! defined(__SMP__)
 #define __SMP__
 #endif
diff --git a/drivers/staging/silicom/bypasslib/bplibk.h 
b/drivers/staging/silicom/bypasslib/bplibk.h
index a1c85ee..e9db2d1 100644
--- a/drivers/staging/silicom/bypasslib/bplibk.h
+++ b/drivers/staging/silicom/bypasslib/bplibk.h
@@ -15,6 +15,7 @@
 
 #include "bp_ioctl.h"
 #include "libbp_sd.h"
+#include 
 
 #define IF_NAME"eth"
 #define SILICOM_VID0x1374
diff --git a/drivers/staging/silicom/bypasslib/bypass.c 
b/drivers/staging/silicom/bypasslib/bypass.c
index 527829d..95a1f18 100644
--- a/drivers/staging/silicom/bypasslib/bypass.c
+++ b/drivers/staging/silicom/bypasslib/bypass.c
@@ -11,7 +11,6 @@
 /*
*/
 
/**/
 
-#include 
 #if defined(CONFIG_SMP) && ! defined(__SMP__)
 #define __SMP__
 #endif
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: remove version.h include from dgrp/dgrp_sysfs.c

2012-10-18 Thread Jesper Juhl
The file uses nothing from linux/version.h, so the include is
pointless - remove it.

Signed-off-by: Jesper Juhl 
---
 drivers/staging/dgrp/dgrp_sysfs.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/dgrp/dgrp_sysfs.c 
b/drivers/staging/dgrp/dgrp_sysfs.c
index e5a3c88..a13318c 100644
--- a/drivers/staging/dgrp/dgrp_sysfs.c
+++ b/drivers/staging/dgrp/dgrp_sysfs.c
@@ -17,7 +17,6 @@
 #include "dgrp_common.h"
 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [media] s5p-tv: don't include linux/version.h in mixer_video.c

2012-10-18 Thread Jesper Juhl
The header is not needed, so remove it.

Signed-off-by: Jesper Juhl 
---
 drivers/media/platform/s5p-tv/mixer_video.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_video.c 
b/drivers/media/platform/s5p-tv/mixer_video.c
index 0c1cd89..9b52f3a 100644
--- a/drivers/media/platform/s5p-tv/mixer_video.c
+++ b/drivers/media/platform/s5p-tv/mixer_video.c
@@ -19,7 +19,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [media] s5p-tv: don't include linux/version.h in mixer_video.c

2012-10-18 Thread Jesper Juhl
The header is not needed, so remove it.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/platform/s5p-tv/mixer_video.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_video.c 
b/drivers/media/platform/s5p-tv/mixer_video.c
index 0c1cd89..9b52f3a 100644
--- a/drivers/media/platform/s5p-tv/mixer_video.c
+++ b/drivers/media/platform/s5p-tv/mixer_video.c
@@ -19,7 +19,6 @@
 #include linux/videodev2.h
 #include linux/mm.h
 #include linux/module.h
-#include linux/version.h
 #include linux/timer.h
 #include media/videobuf2-dma-contig.h
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: remove version.h include from dgrp/dgrp_sysfs.c

2012-10-18 Thread Jesper Juhl
The file uses nothing from linux/version.h, so the include is
pointless - remove it.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/staging/dgrp/dgrp_sysfs.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/dgrp/dgrp_sysfs.c 
b/drivers/staging/dgrp/dgrp_sysfs.c
index e5a3c88..a13318c 100644
--- a/drivers/staging/dgrp/dgrp_sysfs.c
+++ b/drivers/staging/dgrp/dgrp_sysfs.c
@@ -17,7 +17,6 @@
 #include dgrp_common.h
 
 #include linux/kernel.h
-#include linux/version.h
 #include linux/module.h
 #include linux/ctype.h
 #include linux/string.h
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Staging: silicom: Fix up version.h includes

2012-10-18 Thread Jesper Juhl
drivers/staging/silicom/bypasslib/bplibk.h actually uses stuff from
version.h so it should include the header.
drivers/staging/silicom/bp_proc.c and
drivers/staging/silicom/bypasslib/bypass.c currently include the
header but use nothing from it so they don't need to.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/staging/silicom/bp_proc.c  |1 -
 drivers/staging/silicom/bypasslib/bplibk.h |1 +
 drivers/staging/silicom/bypasslib/bypass.c |1 -
 3 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/silicom/bp_proc.c 
b/drivers/staging/silicom/bp_proc.c
index 6ad4b27..32799c7 100644
--- a/drivers/staging/silicom/bp_proc.c
+++ b/drivers/staging/silicom/bp_proc.c
@@ -10,7 +10,6 @@
 /*
*/
 
/**/
 
-#include linux/version.h
 #if defined(CONFIG_SMP)  ! defined(__SMP__)
 #define __SMP__
 #endif
diff --git a/drivers/staging/silicom/bypasslib/bplibk.h 
b/drivers/staging/silicom/bypasslib/bplibk.h
index a1c85ee..e9db2d1 100644
--- a/drivers/staging/silicom/bypasslib/bplibk.h
+++ b/drivers/staging/silicom/bypasslib/bplibk.h
@@ -15,6 +15,7 @@
 
 #include bp_ioctl.h
 #include libbp_sd.h
+#include linux/version.h
 
 #define IF_NAMEeth
 #define SILICOM_VID0x1374
diff --git a/drivers/staging/silicom/bypasslib/bypass.c 
b/drivers/staging/silicom/bypasslib/bypass.c
index 527829d..95a1f18 100644
--- a/drivers/staging/silicom/bypasslib/bypass.c
+++ b/drivers/staging/silicom/bypasslib/bypass.c
@@ -11,7 +11,6 @@
 /*
*/
 
/**/
 
-#include linux/version.h
 #if defined(CONFIG_SMP)  ! defined(__SMP__)
 #define __SMP__
 #endif
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: csr: remove a number of unneeded includes of version.h

2012-10-18 Thread Jesper Juhl

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/staging/csr/csr_framework_ext.c|1 -
 drivers/staging/csr/csr_time.c |1 -
 drivers/staging/csr/io.c   |1 -
 drivers/staging/csr/monitor.c  |1 -
 drivers/staging/csr/netdev.c   |1 -
 drivers/staging/csr/sdio_mmc.c |1 -
 drivers/staging/csr/sme_native.c   |1 -
 drivers/staging/csr/sme_sys.c  |1 -
 drivers/staging/csr/ul_int.c   |1 -
 drivers/staging/csr/unifi_pdu_processing.c |1 -
 drivers/staging/csr/unifi_priv.h   |1 -
 drivers/staging/csr/unifi_wext.h   |1 -
 12 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/csr/csr_framework_ext.c 
b/drivers/staging/csr/csr_framework_ext.c
index f91a4bf..e203f60 100644
--- a/drivers/staging/csr/csr_framework_ext.c
+++ b/drivers/staging/csr/csr_framework_ext.c
@@ -9,7 +9,6 @@
 */
 
 #include linux/kernel.h
-#include linux/version.h
 #include linux/kthread.h
 #include linux/module.h
 #include linux/freezer.h
diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c
index 7b597f7..f4ff98c 100644
--- a/drivers/staging/csr/csr_time.c
+++ b/drivers/staging/csr/csr_time.c
@@ -9,7 +9,6 @@
 */
 
 #include linux/kernel.h
-#include linux/version.h
 #include linux/time.h
 #include linux/module.h
 
diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c
index caf48e3..5206cba 100644
--- a/drivers/staging/csr/io.c
+++ b/drivers/staging/csr/io.c
@@ -31,7 +31,6 @@
  * ---
  */
 #include linux/proc_fs.h
-#include linux/version.h
 
 #include csr_wifi_hip_unifi.h
 #include csr_wifi_hip_unifiversion.h
diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c
index 7c524a1..7b76f07 100644
--- a/drivers/staging/csr/monitor.c
+++ b/drivers/staging/csr/monitor.c
@@ -10,7 +10,6 @@
  * ---
  */
 
-#include linux/version.h
 #include unifi_priv.h
 
 #ifdef UNIFI_SNIFF_ARPHRD
diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c
index 9a52ab4..8a53171 100644
--- a/drivers/staging/csr/netdev.c
+++ b/drivers/staging/csr/netdev.c
@@ -47,7 +47,6 @@
 #include linux/etherdevice.h
 #include linux/mutex.h
 #include linux/semaphore.h
-#include linux/version.h
 #include linux/vmalloc.h
 #include csr_wifi_hip_unifi.h
 #include csr_wifi_hip_conversions.h
diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c
index af3e40b..6b96df1 100644
--- a/drivers/staging/csr/sdio_mmc.c
+++ b/drivers/staging/csr/sdio_mmc.c
@@ -14,7 +14,6 @@
 #include linux/kernel.h
 #include linux/mutex.h
 #include linux/gfp.h
-#include linux/version.h
 #include linux/mmc/core.h
 #include linux/mmc/card.h
 #include linux/mmc/host.h
diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c
index d7a5125..26f10bc 100644
--- a/drivers/staging/csr/sme_native.c
+++ b/drivers/staging/csr/sme_native.c
@@ -12,7 +12,6 @@
  */
 
 #include linux/netdevice.h
-#include linux/version.h
 #include unifi_priv.h
 #include csr_wifi_hip_unifi.h
 #include csr_wifi_hip_conversions.h
diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c
index 5b26c41..90a30dc 100644
--- a/drivers/staging/csr/sme_sys.c
+++ b/drivers/staging/csr/sme_sys.c
@@ -14,7 +14,6 @@
  * ---
  */
 
-#include linux/version.h
 #include csr_wifi_hip_unifiversion.h
 #include unifi_priv.h
 #include csr_wifi_hip_conversions.h
diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c
index 4013d02..0fae6f4 100644
--- a/drivers/staging/csr/ul_int.c
+++ b/drivers/staging/csr/ul_int.c
@@ -12,7 +12,6 @@
  *
  * ***
  */
-#include linux/version.h
 #include csr_wifi_hip_unifi.h
 #include csr_wifi_hip_conversions.h
 #include unifi_priv.h
diff --git a/drivers/staging/csr/unifi_pdu_processing.c 
b/drivers/staging/csr/unifi_pdu_processing.c
index ae7c8fc..a762939 100644
--- a/drivers/staging/csr/unifi_pdu_processing.c
+++ b/drivers/staging/csr/unifi_pdu_processing.c
@@ -14,7 +14,6 @@
  * ---
  */
 
-#include linux/version.h
 #include linux/types.h
 #include linux/etherdevice.h
 #include linux/vmalloc.h
diff --git a/drivers/staging/csr/unifi_priv.h b/drivers/staging/csr/unifi_priv.h
index aec8e28..f25b92a 100644
--- a/drivers/staging/csr/unifi_priv.h
+++ b/drivers/staging/csr/unifi_priv.h
@@ -17,7 +17,6 @@
 #ifndef __LINUX_UNIFI_PRIV_H__
 #define __LINUX_UNIFI_PRIV_H__ 1
 
-#include linux/version.h
 #include linux

Re: [PATCH v2] Documentation DMA-API-HOWTO.txt Add dma mapping error check usage examples

2012-10-18 Thread Jesper Juhl
On Thu, 18 Oct 2012, Shuah Khan wrote:

 Enhance the document to discuss the importance of dma mapping error checks
 after dma_map_single() and dma_map_page() calls. Also added usage examples
 that include unmap examples in error paths when dma mapping error is returned.
 Includes correct and incorrect usages to high light some common mistakes in
 error paths especially when dma mapping fails when more than one dma mapping
 call is made.
 
 Signed-off-by: Shuah Khan shuah.k...@hp.com
[...]

Nit picking :

 +Example 2: (if buffers are allocated a loop, unmap all mapped buffers when
 + mapping error is detected in the middle)
 +

... if buffers are allocated in a loop...

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg()

2012-10-16 Thread Jesper Juhl
On Mon, 15 Oct 2012, Ezequiel Garcia wrote:

> On Mon, Oct 15, 2012 at 9:03 PM, Jesper Juhl  wrote:
> > On Mon, 15 Oct 2012, Ezequiel Garcia wrote:
> >
> >> On Mon, Oct 15, 2012 at 7:52 PM, Jesper Juhl  wrote:
> >> > On Mon, 15 Oct 2012, Jesper Juhl wrote:
> >> >
> >> >> On Sat, 13 Oct 2012, Ezequiel Garcia wrote:
> >> >>
> > [...]
> >> > Currently there are two checks for 'rc' being less than zero with no
> >> > change to 'rc' between the two, so the second is just dead code.
> >> > The intention seems to have been to assign the return value of
> >> > 'stk1160_read_reg()' to 'rc' before the (currently dead) second check
> >> > and then test /that/. This patch does that.
> >> >
> >>
> >> This is an overly complicated explanation for such a small patch.
> >> Can you try to simplify it?
> >>
> > How's this?
> >
> >
> > From: Jesper Juhl 
> > Date: Sat, 13 Oct 2012 00:16:37 +0200
> > Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() 
> > in stk1160_i2c_read_reg()
> >
> > Remember to collect the exit status from 'stk1160_read_reg()' in 'rc'
> > before testing it for less than zero.
> >
> > Signed-off-by: Jesper Juhl 
> > ---
> >  drivers/media/usb/stk1160/stk1160-i2c.c |3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
> > b/drivers/media/usb/stk1160/stk1160-i2c.c
> > index 176ac93..a2370e4 100644
> > --- a/drivers/media/usb/stk1160/stk1160-i2c.c
> > +++ b/drivers/media/usb/stk1160/stk1160-i2c.c
> > @@ -116,10 +116,9 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, 
> > u8 addr,
> > if (rc < 0)
> > return rc;
> >
> > -   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
> > +   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
> > if (rc < 0)
> > return rc;
> > -
> 
> Sorry for the nitpick, but I'd like you to *not* remove this line.
> 
No problem.
I hope the below is OK :-)


From: Jesper Juhl 
Date: Sat, 13 Oct 2012 00:16:37 +0200
Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in 
stk1160_i2c_read_reg()

Remember to collect the exit status from 'stk1160_read_reg()' in 'rc'
before testing it for less than zero.

Signed-off-by: Jesper Juhl 
---
 drivers/media/usb/stk1160/stk1160-i2c.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..850cf28 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,7 +116,7 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
if (rc < 0)
return rc;
 
-   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
+   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
if (rc < 0)
return rc;
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg()

2012-10-16 Thread Jesper Juhl
On Mon, 15 Oct 2012, Ezequiel Garcia wrote:

 On Mon, Oct 15, 2012 at 9:03 PM, Jesper Juhl j...@chaosbits.net wrote:
  On Mon, 15 Oct 2012, Ezequiel Garcia wrote:
 
  On Mon, Oct 15, 2012 at 7:52 PM, Jesper Juhl j...@chaosbits.net wrote:
   On Mon, 15 Oct 2012, Jesper Juhl wrote:
  
   On Sat, 13 Oct 2012, Ezequiel Garcia wrote:
  
  [...]
   Currently there are two checks for 'rc' being less than zero with no
   change to 'rc' between the two, so the second is just dead code.
   The intention seems to have been to assign the return value of
   'stk1160_read_reg()' to 'rc' before the (currently dead) second check
   and then test /that/. This patch does that.
  
 
  This is an overly complicated explanation for such a small patch.
  Can you try to simplify it?
 
  How's this?
 
 
  From: Jesper Juhl j...@chaosbits.net
  Date: Sat, 13 Oct 2012 00:16:37 +0200
  Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() 
  in stk1160_i2c_read_reg()
 
  Remember to collect the exit status from 'stk1160_read_reg()' in 'rc'
  before testing it for less than zero.
 
  Signed-off-by: Jesper Juhl j...@chaosbits.net
  ---
   drivers/media/usb/stk1160/stk1160-i2c.c |3 +--
   1 files changed, 1 insertions(+), 2 deletions(-)
 
  diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
  b/drivers/media/usb/stk1160/stk1160-i2c.c
  index 176ac93..a2370e4 100644
  --- a/drivers/media/usb/stk1160/stk1160-i2c.c
  +++ b/drivers/media/usb/stk1160/stk1160-i2c.c
  @@ -116,10 +116,9 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, 
  u8 addr,
  if (rc  0)
  return rc;
 
  -   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
  +   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
  if (rc  0)
  return rc;
  -
 
 Sorry for the nitpick, but I'd like you to *not* remove this line.
 
No problem.
I hope the below is OK :-)


From: Jesper Juhl j...@chaosbits.net
Date: Sat, 13 Oct 2012 00:16:37 +0200
Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in 
stk1160_i2c_read_reg()

Remember to collect the exit status from 'stk1160_read_reg()' in 'rc'
before testing it for less than zero.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/usb/stk1160/stk1160-i2c.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..850cf28 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,7 +116,7 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
if (rc  0)
return rc;
 
-   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
+   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
if (rc  0)
return rc;
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg()

2012-10-15 Thread Jesper Juhl
On Mon, 15 Oct 2012, Ezequiel Garcia wrote:

> On Mon, Oct 15, 2012 at 7:52 PM, Jesper Juhl  wrote:
> > On Mon, 15 Oct 2012, Jesper Juhl wrote:
> >
> >> On Sat, 13 Oct 2012, Ezequiel Garcia wrote:
> >>
[...]
> > Currently there are two checks for 'rc' being less than zero with no
> > change to 'rc' between the two, so the second is just dead code.
> > The intention seems to have been to assign the return value of
> > 'stk1160_read_reg()' to 'rc' before the (currently dead) second check
> > and then test /that/. This patch does that.
> >
> 
> This is an overly complicated explanation for such a small patch.
> Can you try to simplify it?
> 
How's this?


From: Jesper Juhl 
Date: Sat, 13 Oct 2012 00:16:37 +0200
Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in 
stk1160_i2c_read_reg()

Remember to collect the exit status from 'stk1160_read_reg()' in 'rc' 
before testing it for less than zero.

Signed-off-by: Jesper Juhl 
---
 drivers/media/usb/stk1160/stk1160-i2c.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..a2370e4 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,10 +116,9 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
if (rc < 0)
return rc;
 
-   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
+   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
if (rc < 0)
return rc;
-
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg()

2012-10-15 Thread Jesper Juhl
On Mon, 15 Oct 2012, Jesper Juhl wrote:

> On Sat, 13 Oct 2012, Ezequiel Garcia wrote:
> 
> > On Sun, Nov 9, 2008 at 2:04 PM, Jesper Juhl  wrote:
> > > There are two checks for 'rc' being less than zero with no change to
> > > 'rc' between the two, so the second is just dead code - remove it.
> > >
> > > Signed-off-by: Jesper Juhl 
> > > ---
> > >  drivers/media/usb/stk1160/stk1160-i2c.c |3 ---
> > >  1 files changed, 0 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
> > > b/drivers/media/usb/stk1160/stk1160-i2c.c
> > > index 176ac93..035cf8c 100644
> > > --- a/drivers/media/usb/stk1160/stk1160-i2c.c
> > > +++ b/drivers/media/usb/stk1160/stk1160-i2c.c
> > > @@ -117,9 +117,6 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, 
> > > u8 addr,
> > > return rc;
> > >
> > > stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
> > > -   if (rc < 0)
> > > -   return rc;
> > > -
> > > return 0;
> > >  }
> > >
> > 
> > Thanks for doing this. Wouldn't you like to save stk1160_read_reg
> > return code to rc, instead of this?
> > 
> Ahh yes, I guess I was too quick to just assume it was dead code. 
> Looking at it again; what you suggest must have been the original 
> intention. I'll cook up a new patch.
> 
> Thanks.
> 
From: Jesper Juhl 
Date: Sat, 13 Oct 2012 00:16:37 +0200
Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in 
stk1160_i2c_read_reg()

Currently there are two checks for 'rc' being less than zero with no
change to 'rc' between the two, so the second is just dead code.
The intention seems to have been to assign the return value of
'stk1160_read_reg()' to 'rc' before the (currently dead) second check
and then test /that/. This patch does that.

Signed-off-by: Jesper Juhl 
---
 drivers/media/usb/stk1160/stk1160-i2c.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..a2370e4 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,10 +116,9 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
if (rc < 0)
return rc;
 
-   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
+   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
if (rc < 0)
return rc;
-
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [resend] ACPI: Fix memory leak in acpi_bind_one() (fwd)

2012-10-15 Thread Jesper Juhl
Ok, so I had a little problem with my mail servers clock that caused the 
mail below to be timestamped a few years in the past, so I assume noone 
saw it - thus, resending.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


-- Forwarded message --
Date: Sun, 9 Nov 2008 14:38:30 +0100 (CET)
From: Jesper Juhl 
To: linux-a...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Len Brown 
Subject: [PATCH] ACPI: Fix memory leak in acpi_bind_one()

Memory is allocated with kzalloc() and assigned to
'physical_node'. Then 'physical_node->node_id' is initialized with a
call to 'find_first_zero_bit()', if that results in a value greater
than ACPI_MAX_PHYSICAL_NODE we'll end up jumping to the 'err:' label
and there leave the function and let 'physical_node' go out of scope
and leak the memory we allocated.
This patch fixes the leak by simply freeing the unused/unneeded memory
pointed to by 'physical_node' just before we jump to 'err:'.

Signed-off-by: Jesper Juhl 
---
 drivers/acpi/glue.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index d1a2d74..0837308 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -159,6 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle 
handle)
if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
retval = -ENOSPC;
mutex_unlock(_dev->physical_node_lock);
+   kfree(physical_node);
goto err;
}
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] stk1160: Remove dead code from stk1160_i2c_read_reg()

2012-10-15 Thread Jesper Juhl
On Sat, 13 Oct 2012, Ezequiel Garcia wrote:

> On Sun, Nov 9, 2008 at 2:04 PM, Jesper Juhl  wrote:
> > There are two checks for 'rc' being less than zero with no change to
> > 'rc' between the two, so the second is just dead code - remove it.
> >
> > Signed-off-by: Jesper Juhl 
> > ---
> >  drivers/media/usb/stk1160/stk1160-i2c.c |3 ---
> >  1 files changed, 0 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
> > b/drivers/media/usb/stk1160/stk1160-i2c.c
> > index 176ac93..035cf8c 100644
> > --- a/drivers/media/usb/stk1160/stk1160-i2c.c
> > +++ b/drivers/media/usb/stk1160/stk1160-i2c.c
> > @@ -117,9 +117,6 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
> > addr,
> > return rc;
> >
> > stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
> > -   if (rc < 0)
> > -   return rc;
> > -
> > return 0;
> >  }
> >
> 
> Thanks for doing this. Wouldn't you like to save stk1160_read_reg
> return code to rc, instead of this?
> 
Ahh yes, I guess I was too quick to just assume it was dead code. 
Looking at it again; what you suggest must have been the original 
intention. I'll cook up a new patch.

Thanks.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] stk1160: Remove dead code from stk1160_i2c_read_reg()

2012-10-15 Thread Jesper Juhl
On Sat, 13 Oct 2012, Ezequiel Garcia wrote:

 On Sun, Nov 9, 2008 at 2:04 PM, Jesper Juhl j...@chaosbits.net wrote:
  There are two checks for 'rc' being less than zero with no change to
  'rc' between the two, so the second is just dead code - remove it.
 
  Signed-off-by: Jesper Juhl j...@chaosbits.net
  ---
   drivers/media/usb/stk1160/stk1160-i2c.c |3 ---
   1 files changed, 0 insertions(+), 3 deletions(-)
 
  diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
  b/drivers/media/usb/stk1160/stk1160-i2c.c
  index 176ac93..035cf8c 100644
  --- a/drivers/media/usb/stk1160/stk1160-i2c.c
  +++ b/drivers/media/usb/stk1160/stk1160-i2c.c
  @@ -117,9 +117,6 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
  addr,
  return rc;
 
  stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
  -   if (rc  0)
  -   return rc;
  -
  return 0;
   }
 
 
 Thanks for doing this. Wouldn't you like to save stk1160_read_reg
 return code to rc, instead of this?
 
Ahh yes, I guess I was too quick to just assume it was dead code. 
Looking at it again; what you suggest must have been the original 
intention. I'll cook up a new patch.

Thanks.

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [resend] ACPI: Fix memory leak in acpi_bind_one() (fwd)

2012-10-15 Thread Jesper Juhl
Ok, so I had a little problem with my mail servers clock that caused the 
mail below to be timestamped a few years in the past, so I assume noone 
saw it - thus, resending.

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


-- Forwarded message --
Date: Sun, 9 Nov 2008 14:38:30 +0100 (CET)
From: Jesper Juhl j...@chaosbits.net
To: linux-a...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Len Brown l...@kernel.org
Subject: [PATCH] ACPI: Fix memory leak in acpi_bind_one()

Memory is allocated with kzalloc() and assigned to
'physical_node'. Then 'physical_node-node_id' is initialized with a
call to 'find_first_zero_bit()', if that results in a value greater
than ACPI_MAX_PHYSICAL_NODE we'll end up jumping to the 'err:' label
and there leave the function and let 'physical_node' go out of scope
and leak the memory we allocated.
This patch fixes the leak by simply freeing the unused/unneeded memory
pointed to by 'physical_node' just before we jump to 'err:'.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/acpi/glue.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index d1a2d74..0837308 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -159,6 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle 
handle)
if (physical_node-node_id = ACPI_MAX_PHYSICAL_NODE) {
retval = -ENOSPC;
mutex_unlock(acpi_dev-physical_node_lock);
+   kfree(physical_node);
goto err;
}
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg()

2012-10-15 Thread Jesper Juhl
On Mon, 15 Oct 2012, Jesper Juhl wrote:

 On Sat, 13 Oct 2012, Ezequiel Garcia wrote:
 
  On Sun, Nov 9, 2008 at 2:04 PM, Jesper Juhl j...@chaosbits.net wrote:
   There are two checks for 'rc' being less than zero with no change to
   'rc' between the two, so the second is just dead code - remove it.
  
   Signed-off-by: Jesper Juhl j...@chaosbits.net
   ---
drivers/media/usb/stk1160/stk1160-i2c.c |3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
  
   diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
   b/drivers/media/usb/stk1160/stk1160-i2c.c
   index 176ac93..035cf8c 100644
   --- a/drivers/media/usb/stk1160/stk1160-i2c.c
   +++ b/drivers/media/usb/stk1160/stk1160-i2c.c
   @@ -117,9 +117,6 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, 
   u8 addr,
   return rc;
  
   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
   -   if (rc  0)
   -   return rc;
   -
   return 0;
}
  
  
  Thanks for doing this. Wouldn't you like to save stk1160_read_reg
  return code to rc, instead of this?
  
 Ahh yes, I guess I was too quick to just assume it was dead code. 
 Looking at it again; what you suggest must have been the original 
 intention. I'll cook up a new patch.
 
 Thanks.
 
From: Jesper Juhl j...@chaosbits.net
Date: Sat, 13 Oct 2012 00:16:37 +0200
Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in 
stk1160_i2c_read_reg()

Currently there are two checks for 'rc' being less than zero with no
change to 'rc' between the two, so the second is just dead code.
The intention seems to have been to assign the return value of
'stk1160_read_reg()' to 'rc' before the (currently dead) second check
and then test /that/. This patch does that.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/usb/stk1160/stk1160-i2c.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..a2370e4 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,10 +116,9 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
if (rc  0)
return rc;
 
-   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
+   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
if (rc  0)
return rc;
-
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in stk1160_i2c_read_reg()

2012-10-15 Thread Jesper Juhl
On Mon, 15 Oct 2012, Ezequiel Garcia wrote:

 On Mon, Oct 15, 2012 at 7:52 PM, Jesper Juhl j...@chaosbits.net wrote:
  On Mon, 15 Oct 2012, Jesper Juhl wrote:
 
  On Sat, 13 Oct 2012, Ezequiel Garcia wrote:
 
[...]
  Currently there are two checks for 'rc' being less than zero with no
  change to 'rc' between the two, so the second is just dead code.
  The intention seems to have been to assign the return value of
  'stk1160_read_reg()' to 'rc' before the (currently dead) second check
  and then test /that/. This patch does that.
 
 
 This is an overly complicated explanation for such a small patch.
 Can you try to simplify it?
 
How's this?


From: Jesper Juhl j...@chaosbits.net
Date: Sat, 13 Oct 2012 00:16:37 +0200
Subject: [PATCH] [media] stk1160: Check return value of stk1160_read_reg() in 
stk1160_i2c_read_reg()

Remember to collect the exit status from 'stk1160_read_reg()' in 'rc' 
before testing it for less than zero.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/usb/stk1160/stk1160-i2c.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..a2370e4 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,10 +116,9 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
if (rc  0)
return rc;
 
-   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
+   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
if (rc  0)
return rc;
-
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [media] stk1160: Remove dead code from stk1160_i2c_read_reg()

2012-10-12 Thread Jesper Juhl
There are two checks for 'rc' being less than zero with no change to
'rc' between the two, so the second is just dead code - remove it.

Signed-off-by: Jesper Juhl 
---
 drivers/media/usb/stk1160/stk1160-i2c.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..035cf8c 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -117,9 +117,6 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
return rc;
 
stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
-   if (rc < 0)
-   return rc;
-
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ACPI: Fix memory leak in acpi_bind_one()

2012-10-12 Thread Jesper Juhl
Memory is allocated with kzalloc() and assigned to
'physical_node'. Then 'physical_node->node_id' is initialized with a
call to 'find_first_zero_bit()', if that results in a value greater
than ACPI_MAX_PHYSICAL_NODE we'll end up jumping to the 'err:' label
and there leave the function and let 'physical_node' go out of scope
and leak the memory we allocated.
This patch fixes the leak by simply freeing the unused/unneeded memory
pointed to by 'physical_node' just before we jump to 'err:'.

Signed-off-by: Jesper Juhl 
---
 drivers/acpi/glue.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index d1a2d74..0837308 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -159,6 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle 
handle)
if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
retval = -ENOSPC;
mutex_unlock(_dev->physical_node_lock);
+   kfree(physical_node);
goto err;
}
 
-- 
1.7.1


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ACPI: Fix memory leak in acpi_bind_one()

2012-10-12 Thread Jesper Juhl
Memory is allocated with kzalloc() and assigned to
'physical_node'. Then 'physical_node-node_id' is initialized with a
call to 'find_first_zero_bit()', if that results in a value greater
than ACPI_MAX_PHYSICAL_NODE we'll end up jumping to the 'err:' label
and there leave the function and let 'physical_node' go out of scope
and leak the memory we allocated.
This patch fixes the leak by simply freeing the unused/unneeded memory
pointed to by 'physical_node' just before we jump to 'err:'.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/acpi/glue.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index d1a2d74..0837308 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -159,6 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle 
handle)
if (physical_node-node_id = ACPI_MAX_PHYSICAL_NODE) {
retval = -ENOSPC;
mutex_unlock(acpi_dev-physical_node_lock);
+   kfree(physical_node);
goto err;
}
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [media] stk1160: Remove dead code from stk1160_i2c_read_reg()

2012-10-12 Thread Jesper Juhl
There are two checks for 'rc' being less than zero with no change to
'rc' between the two, so the second is just dead code - remove it.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/usb/stk1160/stk1160-i2c.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..035cf8c 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -117,9 +117,6 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
return rc;
 
stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
-   if (rc  0)
-   return rc;
-
return 0;
 }
 
-- 
1.7.1


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] scripts/checkpatch.pl: A small step for Linux...

2012-08-31 Thread Jesper Juhl
On Fri, 31 Aug 2012, Cruz Julian Bishop wrote:

> ...and a big step for learning more Perl.
> 
> Hi!
> 
> This patch set started off as an experiment, but as I continued, I
> realised that I should submit this and see if it's suitable for merging
> into Linux.
> 
> To start off with, here's some patches for checkincludes.pl
> 
> This set was created for the following purposes:
> 
> 1: Making it slightly easier to read
> 2: Making it easier to extend and add new arguments
> 3: Changing the usage output to look more "correct"
> 4: Introducing a 'quiet' mode like checkpatch.pl, and printing
> messages for files without duplicated includes by default
>
> Sorry if I did anything wrong - It's my first time really
> experimenting with Perl. 
> 
> Thanks in advance.
> 
> ~Cruz
> 
> Cruz Julian Bishop (4):
>   scripts/checkincludes.pl: Print usage with heredoc
>   scripts/checkincludes.pl: Simplify and shorten argument logic
>   scripts/checkincludes.pl: Fix a bug introduced in the last commit
>   scripts/checkincludes.pl: Introduce 'quiet' mode
> 
>  scripts/checkincludes.pl |  113 
> ++
>  1 file changed, 65 insertions(+), 48 deletions(-)
> 
> 
Minor detail. Your patches are for "scripts/checkincludes.pl" but the 
subject says "scripts/checkpatch.pl"... You may want to get it straight 
what you are patching and let the subject reflect reality :-)

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] scripts/checkpatch.pl: A small step for Linux...

2012-08-31 Thread Jesper Juhl
On Fri, 31 Aug 2012, Cruz Julian Bishop wrote:

 ...and a big step for learning more Perl.
 
 Hi!
 
 This patch set started off as an experiment, but as I continued, I
 realised that I should submit this and see if it's suitable for merging
 into Linux.
 
 To start off with, here's some patches for checkincludes.pl
 
 This set was created for the following purposes:
 
 1: Making it slightly easier to read
 2: Making it easier to extend and add new arguments
 3: Changing the usage output to look more correct
 4: Introducing a 'quiet' mode like checkpatch.pl, and printing
 messages for files without duplicated includes by default

 Sorry if I did anything wrong - It's my first time really
 experimenting with Perl. 
 
 Thanks in advance.
 
 ~Cruz
 
 Cruz Julian Bishop (4):
   scripts/checkincludes.pl: Print usage with heredoc
   scripts/checkincludes.pl: Simplify and shorten argument logic
   scripts/checkincludes.pl: Fix a bug introduced in the last commit
   scripts/checkincludes.pl: Introduce 'quiet' mode
 
  scripts/checkincludes.pl |  113 
 ++
  1 file changed, 65 insertions(+), 48 deletions(-)
 
 
Minor detail. Your patches are for scripts/checkincludes.pl but the 
subject says scripts/checkpatch.pl... You may want to get it straight 
what you are patching and let the subject reflect reality :-)

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][trivial] gen_init_cpio: remove redundant empty line

2012-08-29 Thread Jesper Juhl
Just a completely trivial patch to remove a completely redundant blank
line from usr/gen_init_cpio.c

Signed-off-by: Jesper Juhl 
---
 usr/gen_init_cpio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index af0f22f..b2e46bc 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -402,7 +402,6 @@ static char *cpio_replace_env(char *new_location)
return new_location;
 }
 
-
 static int cpio_mkfile_line(const char *line)
 {
char name[PATH_MAX + 1];
-- 
1.7.12


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][trivial] gen_init_cpio: remove redundant empty line

2012-08-29 Thread Jesper Juhl
Just a completely trivial patch to remove a completely redundant blank
line from usr/gen_init_cpio.c

Signed-off-by: Jesper Juhl j...@codesealer.com
---
 usr/gen_init_cpio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index af0f22f..b2e46bc 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -402,7 +402,6 @@ static char *cpio_replace_env(char *new_location)
return new_location;
 }
 
-
 static int cpio_mkfile_line(const char *line)
 {
char name[PATH_MAX + 1];
-- 
1.7.12


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] unifdef: set a secure umask before calling mkstemp()

2012-08-19 Thread Jesper Juhl
On Sat, 18 Aug 2012, Tony Finch wrote:

> Jesper Juhl  wrote:
> 
> > In newer glibc's (versions > 2.06) reasonably secure permissions of
> > 0600 are used when creating a temporary file with mkstemp(). But for
> > older glibc's (versions <= 2.06) 0666 is used which is not secure.
> 
> Thanks for your suggestion! I'm afraid I prefer not to make the change.
> 
> Unifdef is only using mkstemp as a convenient way to open a file with a
> non-clashing name. It isn't trying to be secure, so it's OK just to rely
> on the user's umask. And I find it hard to care about a bug that was fixed
> 15 years ago.
> 
> I'm also trying to reduce the unixisms in the program for portability
> reasons and this is the most awkward part :-/
> 
Fair enough. :-)

Just ignore the patch.

Have a nice day.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] unifdef: set a secure umask before calling mkstemp()

2012-08-19 Thread Jesper Juhl
On Sat, 18 Aug 2012, Tony Finch wrote:

 Jesper Juhl j...@chaosbits.net wrote:
 
  In newer glibc's (versions  2.06) reasonably secure permissions of
  0600 are used when creating a temporary file with mkstemp(). But for
  older glibc's (versions = 2.06) 0666 is used which is not secure.
 
 Thanks for your suggestion! I'm afraid I prefer not to make the change.
 
 Unifdef is only using mkstemp as a convenient way to open a file with a
 non-clashing name. It isn't trying to be secure, so it's OK just to rely
 on the user's umask. And I find it hard to care about a bug that was fixed
 15 years ago.
 
 I'm also trying to reduce the unixisms in the program for portability
 reasons and this is the most awkward part :-/
 
Fair enough. :-)

Just ignore the patch.

Have a nice day.

-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] caif: Do not dereference NULL in chnl_recv_cb()

2012-08-17 Thread Jesper Juhl
In net/caif/chnl_net.c::chnl_recv_cb() we call skb_header_pointer()
which may return NULL, but we do not check for a NULL pointer before
dereferencing it.
This patch adds such a NULL check and properly free's allocated memory
and return an error (-EINVAL) on failure - much better than crashing..

Signed-off-by: Jesper Juhl 
---
 net/caif/chnl_net.c | 4 
 1 file changed, 4 insertions(+)

 Note: compile tested only.

diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
index 69771c0..e597733 100644
--- a/net/caif/chnl_net.c
+++ b/net/caif/chnl_net.c
@@ -94,6 +94,10 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt 
*pkt)
 
/* check the version of IP */
ip_version = skb_header_pointer(skb, 0, 1, );
+   if (!ip_version) {
+   kfree_skb(skb);
+   return -EINVAL;
+   }
 
switch (*ip_version >> 4) {
case 4:
-- 
1.7.11.4


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] unifdef: set a secure umask before calling mkstemp()

2012-08-17 Thread Jesper Juhl
In newer glibc's (versions > 2.06) reasonably secure permissions of
0600 are used when creating a temporary file with mkstemp(). But for
older glibc's (versions <= 2.06) 0666 is used which is not secure.

To ensure that the temporary files created always have reasonably
secure permissions, add a call to umask() that ensures we always set
at most 0600 on the temporary file (and then restore the umask again
so we don't interfere with anything that hapens further on).

Signed-off-by: Jesper Juhl 
---
 scripts/unifdef.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 7493c0e..f9188fb 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -342,9 +342,10 @@ main(int argc, char *argv[])
"%.*s/" TEMPLATE,
(int)(dirsep - ofilename), ofilename);
else
-   snprintf(tempname, sizeof(tempname),
-   TEMPLATE);
+   snprintf(tempname, sizeof(tempname), TEMPLATE);
+   mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
ofd = mkstemp(tempname);
+   umask(mask);
if (ofd != -1)
output = fdopen(ofd, "wb+");
if (output == NULL)
-- 
1.7.11.4


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] unifdef: set a secure umask before calling mkstemp()

2012-08-17 Thread Jesper Juhl
In newer glibc's (versions  2.06) reasonably secure permissions of
0600 are used when creating a temporary file with mkstemp(). But for
older glibc's (versions = 2.06) 0666 is used which is not secure.

To ensure that the temporary files created always have reasonably
secure permissions, add a call to umask() that ensures we always set
at most 0600 on the temporary file (and then restore the umask again
so we don't interfere with anything that hapens further on).

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 scripts/unifdef.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/unifdef.c b/scripts/unifdef.c
index 7493c0e..f9188fb 100644
--- a/scripts/unifdef.c
+++ b/scripts/unifdef.c
@@ -342,9 +342,10 @@ main(int argc, char *argv[])
%.*s/ TEMPLATE,
(int)(dirsep - ofilename), ofilename);
else
-   snprintf(tempname, sizeof(tempname),
-   TEMPLATE);
+   snprintf(tempname, sizeof(tempname), TEMPLATE);
+   mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
ofd = mkstemp(tempname);
+   umask(mask);
if (ofd != -1)
output = fdopen(ofd, wb+);
if (output == NULL)
-- 
1.7.11.4


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] caif: Do not dereference NULL in chnl_recv_cb()

2012-08-17 Thread Jesper Juhl
In net/caif/chnl_net.c::chnl_recv_cb() we call skb_header_pointer()
which may return NULL, but we do not check for a NULL pointer before
dereferencing it.
This patch adds such a NULL check and properly free's allocated memory
and return an error (-EINVAL) on failure - much better than crashing..

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 net/caif/chnl_net.c | 4 
 1 file changed, 4 insertions(+)

 Note: compile tested only.

diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
index 69771c0..e597733 100644
--- a/net/caif/chnl_net.c
+++ b/net/caif/chnl_net.c
@@ -94,6 +94,10 @@ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt 
*pkt)
 
/* check the version of IP */
ip_version = skb_header_pointer(skb, 0, 1, buf);
+   if (!ip_version) {
+   kfree_skb(skb);
+   return -EINVAL;
+   }
 
switch (*ip_version  4) {
case 4:
-- 
1.7.11.4


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tpm: Do not dereference NULL pointer if acpi_os_map_memory() fails.

2012-08-15 Thread Jesper Juhl
In drivers/char/tpm/tpm_acpi.c::read_log() we call
acpi_os_map_memory(). That call may fail for a number of reasons
(invalid address, out of memory etc). If the call fails it returns
NULL and we just pass that to memcpy() unconditionally, which will go
bad when it tries to dereference the pointer.

Unfortunately we just get NULL back, so we can't really tell the user
exactely what went wrong, but we can at least avoid crashing and
return an error (-EIO seemed more generic and more suitable here than
-ENOMEM or something else, so I picked that).

Signed-off-by: Jesper Juhl 
---
 drivers/char/tpm/tpm_acpi.c | 5 +
 1 file changed, 5 insertions(+)

 note: this patch is against git://github.com/shpedoikal/linux.git 
v3.6-rc1-tpmdd-staging

diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
index a1bb5a18..fe3fa94 100644
--- a/drivers/char/tpm/tpm_acpi.c
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -96,6 +96,11 @@ int read_log(struct tpm_bios_log *log)
log->bios_event_log_end = log->bios_event_log + len;
 
virt = acpi_os_map_memory(start, len);
+   if (!virt) {
+   kfree(log->bios_event_log);
+   printk("%s: ERROR - Unable to map memory\n", __func__);
+   return -EIO;
+   }
 
memcpy(log->bios_event_log, virt, len);
 
-- 
1.7.11.4


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tpm: Do not dereference NULL pointer if acpi_os_map_memory() fails.

2012-08-15 Thread Jesper Juhl
On Wed, 15 Aug 2012, Kent Yoder wrote:

> Hi Jesper,
> 
> > > Unfortunately we just get NULL back, so we can't really tell the user
> > > exactely what went wrong, but we can at least avoid crashing and
> > > return an error (-EIO seemed more generic and more suitable here than
> > > -ENOMEM or something else, so I picked that).
> > 
> > Thanks Jesper. I'd made some updates to tpm_bios.c recently but this
> > should still apply. I'll let you know if not.
> 
>   Of course I'm wrong here, this code moved over into tpm_acpi.c. If you
> can resubmit on top of my staging tree, I will apply it there.
> 

No problem. I'll have that patch for you in a moment when I'm done 
fetching your tree.


> git://github.com/shpedoikal/linux.git v3.6-rc1-tpmdd-staging
> 
> > > Signed-off-by: Jesper Juhl 
> > > ---
> > >  drivers/char/tpm/tpm_bios.c | 5 +
> > >  1 file changed, 5 insertions(+)
> > > 
> > >   Compile tested only.
> > > 
> > > diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
> > > index 0636520..0c5c274 100644
> > > --- a/drivers/char/tpm/tpm_bios.c
> > > +++ b/drivers/char/tpm/tpm_bios.c
> > > @@ -410,6 +410,11 @@ static int read_log(struct tpm_bios_log *log)
> > >   log->bios_event_log_end = log->bios_event_log + len;
> > > 
> > >   virt = acpi_os_map_memory(start, len);
> > > + if (!virt) {
> 
>   Also please add kfree(log->bios_event_log); in this error path.
> 
Whoops, of course, will do.


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] tpm: Do not dereference NULL pointer if acpi_os_map_memory() fails.

2012-08-15 Thread Jesper Juhl
On Wed, 15 Aug 2012, Kent Yoder wrote:

 Hi Jesper,
 
   Unfortunately we just get NULL back, so we can't really tell the user
   exactely what went wrong, but we can at least avoid crashing and
   return an error (-EIO seemed more generic and more suitable here than
   -ENOMEM or something else, so I picked that).
  
  Thanks Jesper. I'd made some updates to tpm_bios.c recently but this
  should still apply. I'll let you know if not.
 
   Of course I'm wrong here, this code moved over into tpm_acpi.c. If you
 can resubmit on top of my staging tree, I will apply it there.
 

No problem. I'll have that patch for you in a moment when I'm done 
fetching your tree.


 git://github.com/shpedoikal/linux.git v3.6-rc1-tpmdd-staging
 
   Signed-off-by: Jesper Juhl j...@chaosbits.net
   ---
drivers/char/tpm/tpm_bios.c | 5 +
1 file changed, 5 insertions(+)
   
 Compile tested only.
   
   diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
   index 0636520..0c5c274 100644
   --- a/drivers/char/tpm/tpm_bios.c
   +++ b/drivers/char/tpm/tpm_bios.c
   @@ -410,6 +410,11 @@ static int read_log(struct tpm_bios_log *log)
 log-bios_event_log_end = log-bios_event_log + len;
   
 virt = acpi_os_map_memory(start, len);
   + if (!virt) {
 
   Also please add kfree(log-bios_event_log); in this error path.
 
Whoops, of course, will do.


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] tpm: Do not dereference NULL pointer if acpi_os_map_memory() fails.

2012-08-15 Thread Jesper Juhl
In drivers/char/tpm/tpm_acpi.c::read_log() we call
acpi_os_map_memory(). That call may fail for a number of reasons
(invalid address, out of memory etc). If the call fails it returns
NULL and we just pass that to memcpy() unconditionally, which will go
bad when it tries to dereference the pointer.

Unfortunately we just get NULL back, so we can't really tell the user
exactely what went wrong, but we can at least avoid crashing and
return an error (-EIO seemed more generic and more suitable here than
-ENOMEM or something else, so I picked that).

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/char/tpm/tpm_acpi.c | 5 +
 1 file changed, 5 insertions(+)

 note: this patch is against git://github.com/shpedoikal/linux.git 
v3.6-rc1-tpmdd-staging

diff --git a/drivers/char/tpm/tpm_acpi.c b/drivers/char/tpm/tpm_acpi.c
index a1bb5a18..fe3fa94 100644
--- a/drivers/char/tpm/tpm_acpi.c
+++ b/drivers/char/tpm/tpm_acpi.c
@@ -96,6 +96,11 @@ int read_log(struct tpm_bios_log *log)
log-bios_event_log_end = log-bios_event_log + len;
 
virt = acpi_os_map_memory(start, len);
+   if (!virt) {
+   kfree(log-bios_event_log);
+   printk(%s: ERROR - Unable to map memory\n, __func__);
+   return -EIO;
+   }
 
memcpy(log-bios_event_log, virt, len);
 
-- 
1.7.11.4


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: csr: Fix up version.h includes

2012-08-10 Thread Jesper Juhl
Include version.h where actually needed, remove where unneeded.

Signed-off-by: Jesper Juhl 
---
 drivers/staging/csr/csr_panic.c| 1 -
 drivers/staging/csr/drv.c  | 3 +--
 drivers/staging/csr/io.c   | 2 +-
 drivers/staging/csr/monitor.c  | 3 +--
 drivers/staging/csr/netdev.c   | 3 +--
 drivers/staging/csr/sdio_mmc.c | 2 +-
 drivers/staging/csr/sme_native.c   | 2 +-
 drivers/staging/csr/sme_sys.c  | 2 +-
 drivers/staging/csr/ul_int.c   | 1 +
 drivers/staging/csr/unifi_pdu_processing.c | 2 +-
 drivers/staging/csr/unifi_wext.h   | 1 +
 11 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/csr/csr_panic.c b/drivers/staging/csr/csr_panic.c
index 353a829..095f7fa 100644
--- a/drivers/staging/csr/csr_panic.c
+++ b/drivers/staging/csr/csr_panic.c
@@ -9,7 +9,6 @@
 */
 
 #include 
-#include 
 #include 
 
 #include "csr_panic.h"
diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c
index b2c27f4..9834d92 100644
--- a/drivers/staging/csr/drv.c
+++ b/drivers/staging/csr/drv.c
@@ -15,8 +15,6 @@
  * ---
  */
 
-
-
 /*
  * Porting Notes:
  * Part of this file contains an example for how to glue the OS layer
@@ -37,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "csr_wifi_hip_unifiversion.h"
 #include "unifi_priv.h"
diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c
index e6503d96..deaff25 100644
--- a/drivers/staging/csr/io.c
+++ b/drivers/staging/csr/io.c
@@ -31,6 +31,7 @@
  * ---
  */
 #include 
+#include 
 
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_unifiversion.h"
@@ -38,7 +39,6 @@
 #include "unifiio.h"
 #include "unifi_priv.h"
 
-
 /*
  * Array of pointers to context structs for unifi devices that are present.
  * The index in the array corresponds to the wlan interface number
diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c
index 628782a..ca7559b 100644
--- a/drivers/staging/csr/monitor.c
+++ b/drivers/staging/csr/monitor.c
@@ -10,6 +10,7 @@
  * ---
  */
 
+#include 
 #include "unifi_priv.h"
 
 #ifdef UNIFI_SNIFF_ARPHRD
@@ -23,8 +24,6 @@
 #define ETH_P_80211_RAW ETH_P_ALL
 #endif
 
-
-
 /*
  * ---
  *  uf_start_sniff
diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c
index 1e6e111..0e34020 100644
--- a/drivers/staging/csr/netdev.c
+++ b/drivers/staging/csr/netdev.c
@@ -15,7 +15,6 @@
  * ---
  */
 
-
 /*
  * Porting Notes:
  * This file implements the data plane of the UniFi linux driver.
@@ -48,7 +47,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_conversions.h"
diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c
index d3fd57c..713d2a4 100644
--- a/drivers/staging/csr/sdio_mmc.c
+++ b/drivers/staging/csr/sdio_mmc.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c
index 229268f..845b654 100644
--- a/drivers/staging/csr/sme_native.c
+++ b/drivers/staging/csr/sme_native.c
@@ -12,7 +12,7 @@
  */
 
 #include 
-
+#include 
 #include "unifi_priv.h"
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_conversions.h"
diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c
index 99de27e..7ff3f43 100644
--- a/drivers/staging/csr/sme_sys.c
+++ b/drivers/staging/csr/sme_sys.c
@@ -14,6 +14,7 @@
  * ---
  */
 
+#include 
 #include "csr_wifi_hip_unifiversion.h"
 #include "unifi_priv.h"
 #include "csr_wifi_hip_conversions.h"
@@ -21,7 +22,6 @@
 #include "csr_wifi_sme_sef.h"
 #endif
 
-
 /*
  * This file implements the SME SYS API and contains the following functions:
  * CsrWifiRouterCtrlMediaStatusReqHandler()
diff --git a/drivers/staging/csr/ul_int.c b/drivers/staging/csr/ul_int.c
index 46d3507..819690d 100644
--- a/drivers/staging/csr/ul_int.c
+++ b/drivers/staging/csr/ul_int.c
@@ -12,6 +12,7 @@
  *
  * ***
  */
+#include 
 #include "csr_wifi_hip_unifi.h"
 #include "csr_wifi_hip_conversions.h"
 #include "unifi_priv.h"
diff --git a/drivers/staging/csr/unifi_pdu_p

Re: [PATCH][trivial] ASoC: isabelle: Remove unneeded include of version.h

2012-08-10 Thread Jesper Juhl
On Fri, 10 Aug 2012, Mark Brown wrote:

> On Fri, Aug 10, 2012 at 08:12:57PM +0200, Jesper Juhl wrote:
> > There is no need to include version.h in sound/soc/codecs/isabelle.c -
> > this patch removes the pointless include.
> 
> Not sure what this patch is against, there appears to be no include of
> version.h in current code...

It's against Linus's tree. I created a branch off of master at 
f4ba394c1b02e7fc2179fda8d3941a5b3b65efb6 and did the patch.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH][trivial] ASoC: isabelle: Remove unneeded include of version.h

2012-08-10 Thread Jesper Juhl
There is no need to include version.h in sound/soc/codecs/isabelle.c -
this patch removes the pointless include.

Signed-off-by: Jesper Juhl 
---
 sound/soc/codecs/isabelle.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c
index 5d8f39e..1bf5560 100644
--- a/sound/soc/codecs/isabelle.c
+++ b/sound/soc/codecs/isabelle.c
@@ -13,7 +13,6 @@
  */
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
1.7.11.4


-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Upgraded from 3.4 to 3.5.1 kernel: machine does not boot

2012-08-10 Thread Jesper Juhl
On Fri, 10 Aug 2012, Justin Piszcz wrote:

> Hello,
> 
> Motherboard: Supermicro X8DTH-6F
> Distro: Debian Testing x86_64
> 
> >From 3.4 -> 3.5.1 on x86_64 make oldconfig and a few minor changes and the
> machine attempts to boot but hangs at the filesystem mounting part of the
> boot process.
> 
> Picture of where it stops working (a little burry but readable)
> http://home.comcast.net/~jpiszcz/20120810/3.5-kernel-hangs.jpg
> 
> Kernel config 3.4 (working)
> http://home.comcast.net/~jpiszcz/20120810/config-3.4.txt
> 
> Kernel config 3.5.1 (hangs)
> http://home.comcast.net/~jpiszcz/20120810/config-3.5.1.txt
> 
> As you see towards the end the machine has been sitting there for 1 hour as
> that's the timeout I have the drives spindown on the 3ware card.
> 
> Any thoughts as what is wrong here?
> 
Not really, but some (rather obvious) ideas on what to try:

- Does 3.5 work? (could be that whatever broke things for you was 
introduced in 3.5.1).

- Does the latest 3.4.8 work?

- Does 3.6-rc1 (or even the latest snapshot of Linus' tree, post-rc1) 
work?

- If noone comes up with a good idea as to the cause of your troubles, you 
could try bisecting between your last working kernel and 3.5.1 to try and 
narrow it down to one (or a few) commits that are causing your trouble.

-- 
Jesper Juhlhttp://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >