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


Groups > linux.kernel > #1511643 > unrolled thread

[PATCH 2/4] isdn/eicon: fix some message formatting errors

Started byNicolas Iooss <nicolas.iooss_linux@m4x.org>
First post2016-10-29 15:00 +0200
Last post2016-10-31 14:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/4] isdn/eicon: fix some message formatting errors Nicolas Iooss <nicolas.iooss_linux@m4x.org> - 2016-10-29 15:00 +0200
    RE: [PATCH 2/4] isdn/eicon: fix some message formatting errors David Laight <David.Laight@ACULAB.COM> - 2016-10-31 14:50 +0100

#1511643 — [PATCH 2/4] isdn/eicon: fix some message formatting errors

FromNicolas Iooss <nicolas.iooss_linux@m4x.org>
Date2016-10-29 15:00 +0200
Subject[PATCH 2/4] isdn/eicon: fix some message formatting errors
Message-ID<sxBoS-6kQ-1@gated-at.bofh.it>
There are some inconsistent debug message formats in message.c. For
example,

    dprintf("XDI CAPI: RC cancelled Id:0x02, Ch:%02x", e->Id, ch);

wrongly reports an ID of 2 and prints the entity ID as the channel ID.
There are also object pointers which are used instead of the IDs.

All these inconsistent formats have been found by adding __printf
attribute to myDbgPrint_...() functions (used by dbug()). As this makes
the compiler to also complain about using "%ld" with unsigned int values
(instead of "%u") and some other less-important format issues, this
patch does not add any __printf attribute.

This patch has only been compile-tested.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
---
 drivers/isdn/hardware/eicon/message.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 1a1d99704fe6..7cafa34c3464 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -1059,7 +1059,7 @@ static void plci_remove(PLCI *plci)
 	}
 	if (plci->Sig.Id == 0xff)
 	{
-		dbug(1, dprintf("D-channel X.25 plci->NL.Id:%0x", plci->NL.Id));
+		dbug(1, dprintf("D-channel X.25 plci->NL.Id:%02x", plci->NL.Id));
 		if (plci->NL.Id && !plci->nl_remove_id)
 		{
 			nl_req_ncci(plci, REMOVE, 0);
@@ -3109,7 +3109,7 @@ static byte data_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
 
 	Info = _WRONG_IDENTIFIER;
 	ncci = (word)(Id >> 16);
-	dbug(1, dprintf("ncci=0x%x, plci=0x%x", ncci, plci));
+	dbug(1, dprintf("ncci=0x%x, plci=0x%x", ncci, plci->Id));
 
 	if (plci && ncci)
 	{
@@ -3325,7 +3325,7 @@ static byte select_b_req(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
 	else
 	{
 		dbug(1, dprintf("select_b_req[%d],PLCI=0x%x,Tel=0x%x,NL=0x%x,appl=0x%x,sstate=0x%x",
-				msg->length, plci->Id, plci->tel, plci->NL.Id, plci->appl, plci->SuppState));
+				msg->length, plci->Id, plci->tel, plci->NL.Id, appl->Id, plci->SuppState));
 		dbug(1, dprintf("PlciState=0x%x", plci->State));
 		for (i = 0; i < 7; i++) bp_parms[i].length = 0;
 
@@ -3910,7 +3910,7 @@ void callback(ENTITY *e)
 				if (no_cancel_rc && (a->FlowControlIdTable[ch] == e->Id) && e->Id) {
 					a->FlowControlIdTable[ch] = 0;
 					if ((rc == OK) && a->FlowControlSkipTable[ch]) {
-						dbug(3, dprintf("XDI CAPI: RC cancelled Id:0x02, Ch:%02x", e->Id, ch));
+						dbug(3, dprintf("XDI CAPI: RC cancelled Id:%02x, Ch:%02x", e->Id, ch));
 						return;
 					}
 				}
@@ -9135,7 +9135,7 @@ static word AdvCodecSupport(DIVA_CAPI_ADAPTER *a, PLCI *plci, APPL *appl,
 		{
 			if (a->AdvSignalAppl != appl || a->AdvSignalPLCI)
 			{
-				dbug(1, dprintf("AdvSigPlci=0x%x", a->AdvSignalPLCI));
+				dbug(1, dprintf("AdvSigPlci=0x%x", a->AdvSignalPLCI->Id));
 				return 0x2001; /* codec in use by another application */
 			}
 			if (plci != NULL)
-- 
2.10.1

[toc] | [next] | [standalone]


#1512562

FromDavid Laight <David.Laight@ACULAB.COM>
Date2016-10-31 14:50 +0100
Message-ID<syl8l-33q-9@gated-at.bofh.it>
In reply to#1511643
From: Nicolas Iooss
> Sent: 29 October 2016 13:56
> There are some inconsistent debug message formats in message.c. For
> example,
> 
>     dprintf("XDI CAPI: RC cancelled Id:0x02, Ch:%02x", e->Id, ch);
> 
> wrongly reports an ID of 2 and prints the entity ID as the channel ID.
> There are also object pointers which are used instead of the IDs.
> 
> All these inconsistent formats have been found by adding __printf
> attribute to myDbgPrint_...() functions (used by dbug()). As this makes
> the compiler to also complain about using "%ld" with unsigned int values
> (instead of "%u")...

The problem isn’t 'u' <=> 'd' but the 'l'.
They need fixing as well.
It only appears to work because the 64bit architectures pass enough
arguments in registers.

	David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web