Skip to content

Commit

Permalink
mt7615,mt7915: replace fw log 0-terminating code with wiphy info leng…
Browse files Browse the repository at this point in the history
…th limit

Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
nbd168 committed Mar 27, 2021
1 parent b860906 commit 465dda6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mt7615/mcu.c
Expand Up @@ -424,8 +424,8 @@ mt7615_mcu_rx_log_message(struct mt7615_dev *dev, struct sk_buff *skb)
break;
}

skb->data[skb->len] = 0;
wiphy_info(mt76_hw(dev)->wiphy, "%s: %s", type, data);
wiphy_info(mt76_hw(dev)->wiphy, "%s: %*s", type,
skb->len - sizeof(*rxd), data);
}

static void
Expand Down
4 changes: 2 additions & 2 deletions mt7915/mcu.c
Expand Up @@ -521,8 +521,8 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
break;
}

skb->data[skb->len] = 0;
wiphy_info(mt76_hw(dev)->wiphy, "%s: %s", type, data);
wiphy_info(mt76_hw(dev)->wiphy, "%s: %*s", type,
skb->len - sizeof(*rxd), data);
}

static void
Expand Down

2 comments on commit 465dda6

@ptpt52
Copy link

@ptpt52 ptpt52 commented on 465dda6 Mar 31, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nbd168 so what is the "%*s" format?

@yogo1212
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptpt52 you don't expect him to answer, do you? :-D

man 3 printf:

   Field width
       An  optional  decimal  digit string (with nonzero first digit) specifying a minimum field width.  If the converted value has fewer characters than the field width, it will be padded with spaces on the left (or right, if the
       left-adjustment flag has been given).  Instead of a decimal digit string one may write "*" or "*m$" (for some decimal integer m) to specify that the field width is given in the next argument, or in the  m-th  argument,  re‐
       spectively,  which  must be of type int.  A negative field width is taken as a '-' flag followed by a positive field width.  In no case does a nonexistent or small field width cause truncation of a field; if the result of a
       conversion is wider than the field width, the field is expanded to contain the conversion result.

   Precision
       An optional precision, in the form of a period ('.')  followed by an optional decimal digit string.  Instead of a decimal digit string one may write "*" or "*m$" (for some decimal integer m) to specify that the precision is
       given  in  the  next  argument, or in the m-th argument, respectively, which must be of type int.  If the precision is given as just '.', the precision is taken to be zero.  A negative precision is taken as if the precision
       were omitted.  This gives the minimum number of digits to appear for d, i, o, u, x, and X conversions, the number of digits to appear after the radix character for a, A, e, E, f, and F conversions,  the  maximum  number  of
       significant digits for g and G conversions, or the maximum number of characters to be printed from a string for s and S conversions.

Please sign in to comment.