diff mbox series

[net-next,6/9] s390/qeth: fix various format strings

Message ID 20211025095658.3527635-7-jwi@linux.ibm.com (mailing list archive)
State Accepted
Commit 22e2b5cdb0b9b59d4df6da5ca9bc5773a4f8e3ea
Delegated to: Netdev Maintainers
Headers show
Series s390/qeth: updates 2021-10-25 | expand

Checks

Context Check Description
netdev/cover_letter success Series has a cover letter
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 3 maintainers not CCed: gor@linux.ibm.com borntraeger@de.ibm.com agordeev@linux.ibm.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 49 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Julian Wiedmann Oct. 25, 2021, 9:56 a.m. UTC
From: Heiko Carstens <hca@linux.ibm.com>

Various format strings don't match with types of parameters.
Fix all of them.

Acked-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Vladimir Oltean Oct. 25, 2021, 1:22 p.m. UTC | #1
On Mon, Oct 25, 2021 at 11:56:55AM +0200, Julian Wiedmann wrote:
> From: Heiko Carstens <hca@linux.ibm.com>
> 
> Various format strings don't match with types of parameters.
> Fix all of them.
> 
> Acked-by: Julian Wiedmann <jwi@linux.ibm.com>
> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
> ---
>  drivers/s390/net/qeth_l2_main.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
> index adba52da9cab..0347fc184786 100644
> --- a/drivers/s390/net/qeth_l2_main.c
> +++ b/drivers/s390/net/qeth_l2_main.c
> @@ -661,13 +661,13 @@ static void qeth_l2_dev2br_fdb_notify(struct qeth_card *card, u8 code,
>  					 card->dev, &info.info, NULL);
>  		QETH_CARD_TEXT(card, 4, "andelmac");
>  		QETH_CARD_TEXT_(card, 4,
> -				"mc%012lx", ether_addr_to_u64(ntfy_mac));
> +				"mc%012llx", ether_addr_to_u64(ntfy_mac));
>  	} else {
>  		call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE,
>  					 card->dev, &info.info, NULL);
>  		QETH_CARD_TEXT(card, 4, "anaddmac");
>  		QETH_CARD_TEXT_(card, 4,
> -				"mc%012lx", ether_addr_to_u64(ntfy_mac));
> +				"mc%012llx", ether_addr_to_u64(ntfy_mac));

You can print MAC addresses using the "%pM" printf format specifier, and
the ntfy_mac as argument.

>  	}
>  }
>  
> @@ -765,8 +765,8 @@ static void qeth_l2_br2dev_worker(struct work_struct *work)
>  	int err = 0;
>  
>  	kfree(br2dev_event_work);
> -	QETH_CARD_TEXT_(card, 4, "b2dw%04x", event);
> -	QETH_CARD_TEXT_(card, 4, "ma%012lx", ether_addr_to_u64(addr));
> +	QETH_CARD_TEXT_(card, 4, "b2dw%04lx", event);
> +	QETH_CARD_TEXT_(card, 4, "ma%012llx", ether_addr_to_u64(addr));
>  
>  	rcu_read_lock();
>  	/* Verify preconditions are still valid: */
> @@ -795,7 +795,7 @@ static void qeth_l2_br2dev_worker(struct work_struct *work)
>  				if (err) {
>  					QETH_CARD_TEXT(card, 2, "b2derris");
>  					QETH_CARD_TEXT_(card, 2,
> -							"err%02x%03d", event,
> +							"err%02lx%03d", event,
>  							lowerdev->ifindex);
>  				}
>  			}
> @@ -813,7 +813,7 @@ static void qeth_l2_br2dev_worker(struct work_struct *work)
>  			break;
>  		}
>  		if (err)
> -			QETH_CARD_TEXT_(card, 2, "b2derr%02x", event);
> +			QETH_CARD_TEXT_(card, 2, "b2derr%02lx", event);
>  	}
>  
>  unlock:
> @@ -878,7 +878,7 @@ static int qeth_l2_switchdev_event(struct notifier_block *unused,
>  	while (lowerdev) {
>  		if (qeth_l2_must_learn(lowerdev, dstdev)) {
>  			card = lowerdev->ml_priv;
> -			QETH_CARD_TEXT_(card, 4, "b2dqw%03x", event);
> +			QETH_CARD_TEXT_(card, 4, "b2dqw%03lx", event);
>  			rc = qeth_l2_br2dev_queue_work(brdev, lowerdev,
>  						       dstdev, event,
>  						       fdb_info->addr);
> -- 
> 2.25.1
>
Julian Wiedmann Oct. 25, 2021, 1:35 p.m. UTC | #2
On 25.10.21 15:22, Vladimir Oltean wrote:
> On Mon, Oct 25, 2021 at 11:56:55AM +0200, Julian Wiedmann wrote:
>> From: Heiko Carstens <hca@linux.ibm.com>
>>
>> Various format strings don't match with types of parameters.
>> Fix all of them.
>>
>> Acked-by: Julian Wiedmann <jwi@linux.ibm.com>
>> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
>> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
>> ---
>>  drivers/s390/net/qeth_l2_main.c | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
>> index adba52da9cab..0347fc184786 100644
>> --- a/drivers/s390/net/qeth_l2_main.c
>> +++ b/drivers/s390/net/qeth_l2_main.c
>> @@ -661,13 +661,13 @@ static void qeth_l2_dev2br_fdb_notify(struct qeth_card *card, u8 code,
>>  					 card->dev, &info.info, NULL);
>>  		QETH_CARD_TEXT(card, 4, "andelmac");
>>  		QETH_CARD_TEXT_(card, 4,
>> -				"mc%012lx", ether_addr_to_u64(ntfy_mac));
>> +				"mc%012llx", ether_addr_to_u64(ntfy_mac));
>>  	} else {
>>  		call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE,
>>  					 card->dev, &info.info, NULL);
>>  		QETH_CARD_TEXT(card, 4, "anaddmac");
>>  		QETH_CARD_TEXT_(card, 4,
>> -				"mc%012lx", ether_addr_to_u64(ntfy_mac));
>> +				"mc%012llx", ether_addr_to_u64(ntfy_mac));
> 
> You can print MAC addresses using the "%pM" printf format specifier, and
> the ntfy_mac as argument.
> 

Unfortunately not - no pointers allowed in such s390 dbf trace entries. See
e19e5be8b4ca ("s390/qeth: sanitize strings in debug messages").
Vladimir Oltean Oct. 25, 2021, 2:32 p.m. UTC | #3
On Mon, Oct 25, 2021 at 03:35:25PM +0200, Julian Wiedmann wrote:
> On 25.10.21 15:22, Vladimir Oltean wrote:
> > On Mon, Oct 25, 2021 at 11:56:55AM +0200, Julian Wiedmann wrote:
> >> From: Heiko Carstens <hca@linux.ibm.com>
> >>
> >> Various format strings don't match with types of parameters.
> >> Fix all of them.
> >>
> >> Acked-by: Julian Wiedmann <jwi@linux.ibm.com>
> >> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
> >> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
> >> ---
> >>  drivers/s390/net/qeth_l2_main.c | 14 +++++++-------
> >>  1 file changed, 7 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
> >> index adba52da9cab..0347fc184786 100644
> >> --- a/drivers/s390/net/qeth_l2_main.c
> >> +++ b/drivers/s390/net/qeth_l2_main.c
> >> @@ -661,13 +661,13 @@ static void qeth_l2_dev2br_fdb_notify(struct qeth_card *card, u8 code,
> >>  					 card->dev, &info.info, NULL);
> >>  		QETH_CARD_TEXT(card, 4, "andelmac");
> >>  		QETH_CARD_TEXT_(card, 4,
> >> -				"mc%012lx", ether_addr_to_u64(ntfy_mac));
> >> +				"mc%012llx", ether_addr_to_u64(ntfy_mac));
> >>  	} else {
> >>  		call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE,
> >>  					 card->dev, &info.info, NULL);
> >>  		QETH_CARD_TEXT(card, 4, "anaddmac");
> >>  		QETH_CARD_TEXT_(card, 4,
> >> -				"mc%012lx", ether_addr_to_u64(ntfy_mac));
> >> +				"mc%012llx", ether_addr_to_u64(ntfy_mac));
> > 
> > You can print MAC addresses using the "%pM" printf format specifier, and
> > the ntfy_mac as argument.
> > 
> 
> Unfortunately not - no pointers allowed in such s390 dbf trace entries. See
> e19e5be8b4ca ("s390/qeth: sanitize strings in debug messages").

Is this because __debug_sprintf_event() saves just the printf-formatted
string and evaluates it only when the trace buffer is shown? Sorry for
my ignorance.
diff mbox series

Patch

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index adba52da9cab..0347fc184786 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -661,13 +661,13 @@  static void qeth_l2_dev2br_fdb_notify(struct qeth_card *card, u8 code,
 					 card->dev, &info.info, NULL);
 		QETH_CARD_TEXT(card, 4, "andelmac");
 		QETH_CARD_TEXT_(card, 4,
-				"mc%012lx", ether_addr_to_u64(ntfy_mac));
+				"mc%012llx", ether_addr_to_u64(ntfy_mac));
 	} else {
 		call_switchdev_notifiers(SWITCHDEV_FDB_ADD_TO_BRIDGE,
 					 card->dev, &info.info, NULL);
 		QETH_CARD_TEXT(card, 4, "anaddmac");
 		QETH_CARD_TEXT_(card, 4,
-				"mc%012lx", ether_addr_to_u64(ntfy_mac));
+				"mc%012llx", ether_addr_to_u64(ntfy_mac));
 	}
 }
 
@@ -765,8 +765,8 @@  static void qeth_l2_br2dev_worker(struct work_struct *work)
 	int err = 0;
 
 	kfree(br2dev_event_work);
-	QETH_CARD_TEXT_(card, 4, "b2dw%04x", event);
-	QETH_CARD_TEXT_(card, 4, "ma%012lx", ether_addr_to_u64(addr));
+	QETH_CARD_TEXT_(card, 4, "b2dw%04lx", event);
+	QETH_CARD_TEXT_(card, 4, "ma%012llx", ether_addr_to_u64(addr));
 
 	rcu_read_lock();
 	/* Verify preconditions are still valid: */
@@ -795,7 +795,7 @@  static void qeth_l2_br2dev_worker(struct work_struct *work)
 				if (err) {
 					QETH_CARD_TEXT(card, 2, "b2derris");
 					QETH_CARD_TEXT_(card, 2,
-							"err%02x%03d", event,
+							"err%02lx%03d", event,
 							lowerdev->ifindex);
 				}
 			}
@@ -813,7 +813,7 @@  static void qeth_l2_br2dev_worker(struct work_struct *work)
 			break;
 		}
 		if (err)
-			QETH_CARD_TEXT_(card, 2, "b2derr%02x", event);
+			QETH_CARD_TEXT_(card, 2, "b2derr%02lx", event);
 	}
 
 unlock:
@@ -878,7 +878,7 @@  static int qeth_l2_switchdev_event(struct notifier_block *unused,
 	while (lowerdev) {
 		if (qeth_l2_must_learn(lowerdev, dstdev)) {
 			card = lowerdev->ml_priv;
-			QETH_CARD_TEXT_(card, 4, "b2dqw%03x", event);
+			QETH_CARD_TEXT_(card, 4, "b2dqw%03lx", event);
 			rc = qeth_l2_br2dev_queue_work(brdev, lowerdev,
 						       dstdev, event,
 						       fdb_info->addr);