From: Tilman Schmidt <[email protected]>, Hansjoerg Lipp <[email protected]>
This patch elliminates the from_user argument from a debugging
function, thus easing the job of sparse. Please merge.
Signed-off-by: Hansjoerg Lipp <[email protected]>
Signed-off-by: Tilman Schmidt <[email protected]>
---
drivers/isdn/gigaset/asyncdata.c | 2 +-
drivers/isdn/gigaset/bas-gigaset.c | 2 +-
drivers/isdn/gigaset/common.c | 30 +++++++-----------------------
drivers/isdn/gigaset/gigaset.h | 2 +-
drivers/isdn/gigaset/interface.c | 7 ++++---
drivers/isdn/gigaset/isocdata.c | 4 ++--
drivers/isdn/gigaset/usb-gigaset.c | 4 ++--
7 files changed, 18 insertions(+), 33 deletions(-)
--- linux-2.6.16-gig-uninline/drivers/isdn/gigaset/gigaset.h 2006-04-02 18:42:34.000000000 +0200
+++ linux-2.6.16-gig-from_user/drivers/isdn/gigaset/gigaset.h 2006-04-02 18:43:01.000000000 +0200
@@ -154,7 +154,7 @@ enum debuglevel { /* up to 24 bits (atom
#endif
void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
- size_t len, const unsigned char *buf, int from_user);
+ size_t len, const unsigned char *buf);
/* connection state */
#define ZSAU_NONE 0
--- linux-2.6.16-gig-uninline/drivers/isdn/gigaset/common.c 2006-04-02 18:42:34.000000000 +0200
+++ linux-2.6.16-gig-from_user/drivers/isdn/gigaset/common.c 2006-04-02 18:43:01.000000000 +0200
@@ -79,50 +79,34 @@ __u8 gigaset_invtab[256] = {
EXPORT_SYMBOL_GPL(gigaset_invtab);
void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
- size_t len, const unsigned char *buf, int from_user)
+ size_t len, const unsigned char *buf)
{
unsigned char outbuf[80];
- unsigned char inbuf[80 - 1];
unsigned char c;
- size_t numin;
- const unsigned char *in;
size_t space = sizeof outbuf - 1;
unsigned char *out = outbuf;
+ size_t numin = len;
- if (!from_user) {
- in = buf;
- numin = len;
- } else {
- numin = len < sizeof inbuf ? len : sizeof inbuf;
- in = inbuf;
- if (copy_from_user(inbuf, (const unsigned char __user *) buf,
- numin)) {
- gig_dbg(level, "%s (%u bytes) - copy_from_user failed",
- msg, (unsigned) len);
- return;
- }
- }
-
- while (numin-- > 0) {
+ while (numin--) {
c = *buf++;
if (c == '~' || c == '^' || c == '\\') {
- if (space-- <= 0)
+ if (!space--)
break;
*out++ = '\\';
}
if (c & 0x80) {
- if (space-- <= 0)
+ if (!space--)
break;
*out++ = '~';
c ^= 0x80;
}
if (c < 0x20 || c == 0x7f) {
- if (space-- <= 0)
+ if (!space--)
break;
*out++ = '^';
c ^= 0x40;
}
- if (space-- <= 0)
+ if (!space--)
break;
*out++ = c;
}
--- linux-2.6.16-gig-uninline/drivers/isdn/gigaset/interface.c 2006-04-02 18:40:48.000000000 +0200
+++ linux-2.6.16-gig-from_user/drivers/isdn/gigaset/interface.c 2006-04-02 18:43:01.000000000 +0200
@@ -246,8 +246,6 @@ static int if_ioctl(struct tty_struct *t
break;
case GIGASET_BRKCHARS:
//FIXME test if MS_LOCKED
- gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
- 6, (const unsigned char *) arg, 1);
if (!atomic_read(&cs->connected)) {
gig_dbg(DEBUG_ANY,
"can't communicate with unplugged device");
@@ -257,8 +255,11 @@ static int if_ioctl(struct tty_struct *t
retval = copy_from_user(&buf,
(const unsigned char __user *) arg, 6)
? -EFAULT : 0;
- if (retval >= 0)
+ if (retval >= 0) {
+ gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
+ 6, (const unsigned char *) arg);
retval = cs->ops->brkchars(cs, buf);
+ }
break;
case GIGASET_VERSION:
retval = copy_from_user(version,
--- linux-2.6.16-gig-uninline/drivers/isdn/gigaset/bas-gigaset.c 2006-04-02 18:42:01.000000000 +0200
+++ linux-2.6.16-gig-from_user/drivers/isdn/gigaset/bas-gigaset.c 2006-04-02 18:43:01.000000000 +0200
@@ -1756,7 +1756,7 @@ static int gigaset_write_cmd(struct card
gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
- "CMD Transmit", len, buf, 0);
+ "CMD Transmit", len, buf);
if (unlikely(!atomic_read(&cs->connected))) {
err("%s: disconnected", __func__);
--- linux-2.6.16-gig-uninline/drivers/isdn/gigaset/isocdata.c 2006-04-02 18:42:01.000000000 +0200
+++ linux-2.6.16-gig-from_user/drivers/isdn/gigaset/isocdata.c 2006-04-02 18:43:01.000000000 +0200
@@ -957,11 +957,11 @@ void gigaset_isoc_input(struct inbuf_t *
if (atomic_read(&cs->mstate) == MS_LOCKED) {
gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
- numbytes, src, 0);
+ numbytes, src);
gigaset_if_receive(inbuf->cs, src, numbytes);
} else {
gigaset_dbg_buffer(DEBUG_CMD, "received response",
- numbytes, src, 0);
+ numbytes, src);
cmd_loop(src, numbytes, inbuf);
}
--- linux-2.6.16-gig-uninline/drivers/isdn/gigaset/usb-gigaset.c 2006-04-02 18:42:01.000000000 +0200
+++ linux-2.6.16-gig-from_user/drivers/isdn/gigaset/usb-gigaset.c 2006-04-02 18:43:04.000000000 +0200
@@ -500,7 +500,7 @@ static int gigaset_write_cmd(struct card
gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
- "CMD Transmit", len, buf, 0);
+ "CMD Transmit", len, buf);
if (!atomic_read(&cs->connected)) {
err("%s: not connected", __func__);
@@ -559,7 +559,7 @@ static int gigaset_brkchars(struct cards
#ifdef CONFIG_GIGASET_UNDOCREQ
struct usb_device *udev = cs->hw.usb->udev;
- gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf, 0);
+ gigaset_dbg_buffer(DEBUG_USBREQ, "brkchars", 6, buf);
memcpy(cs->hw.usb->bchars, buf, 6);
return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x19, 0x41,
0, 0, &buf, 6, 2000);
--- linux-2.6.16-gig-uninline/drivers/isdn/gigaset/asyncdata.c 2006-04-02 18:42:01.000000000 +0200
+++ linux-2.6.16-gig-from_user/drivers/isdn/gigaset/asyncdata.c 2006-04-02 18:43:01.000000000 +0200
@@ -98,7 +98,7 @@ static inline int lock_loop(unsigned cha
struct cardstate *cs = inbuf->cs;
gigaset_dbg_buffer(DEBUG_LOCKCMD, "received response",
- numbytes, src, 0);
+ numbytes, src);
gigaset_if_receive(cs, src, numbytes);
return numbytes;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]