2
0

894-v6.8-net-ethtool-implement-ethtool_puts.patch 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. From mboxrd@z Thu Jan 1 00:00:00 1970
  2. Authentication-Results: smtp.subspace.kernel.org;
  3. dkim=pass (2048-bit key) header.d=google.com [email protected] header.b="sMUeie/T"
  4. Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49])
  5. by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB8D6D
  6. for <[email protected]>; Wed, 6 Dec 2023 15:16:16 -0800 (PST)
  7. Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db5416d0fccso403298276.1
  8. for <[email protected]>; Wed, 06 Dec 2023 15:16:16 -0800 (PST)
  9. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
  10. d=google.com; s=20230601; t=1701904575; x=1702509375; darn=vger.kernel.org;
  11. h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
  12. :date:from:to:cc:subject:date:message-id:reply-to;
  13. bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=;
  14. b=sMUeie/TxdytzC0EyT11QWi1TqTtiv7KCTs1F2vLmUUvPKNA3+1MHFo8ECW+0gQuDE
  15. FGrgdZKGK5mXQgkF0N3JiSLvKO8tpQOIB57JLCG5IVy5dr2vVv0ExU3Dag2Cc4oBIBIO
  16. w/cH95O1oPlvluIpATmAsxenVr7mFomU63BqYiRGLaEhWeb2hJ636GO8lubtsDfdFFoi
  17. GPOL2tQwV93VnqmywBBpFaNAULN0UoCFhfkKv5prvpkXq19sWI7zyorVZ+rdTYem5m4T
  18. dXsDaLXPtC3Dh2JOad1duSQIah/wCHYYUcV3IoFhwj2y0Uk/TTCrnZPORweSADcEy6Ho
  19. vDrA==
  20. X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
  21. d=1e100.net; s=20230601; t=1701904575; x=1702509375;
  22. h=cc:to:from:subject:message-id:references:mime-version:in-reply-to
  23. :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
  24. bh=/7eYcPC4ZNNyPcPPs0B5tDplF0arxw3r0vINNNou0rY=;
  25. b=Dmc6aSntxPlxAk72zVO1G9WoZnFtLolxENlLscYYAHG3VE+PQ8gGN2rPzcGoKb2Btb
  26. 4b0PvjOzSlPQyghahdhdlz04RtAeeGG/MkfNiYjFql5OifIoovb51kroiPYrVsa7Ps7Y
  27. +Pxug0+NPdTm5s9TNz940ZKl3GRME8UTmVxpWJRX03XMOqb6Wgsh2SK9ahXKc4yRsi62
  28. 3a3J72WmmSgvimxwM/99fXwvoUQpiv2J1xCoqc1Ng4q4qSuZvzmHN7ZTGaUhLxOqLeLK
  29. 3W4RKHW6rZ7UjppuB6I3NXW+D344By2rdKp1sRXpjdQ0GS3YUcvlRETcJBXJudHfQP5Y
  30. CLOw==
  31. X-Gm-Message-State: AOJu0YzdCTLdwny+N99zeMgyKqFsEZhfIhL2cbgKA6zC1U/OLkxxRLoM
  32. XrYVBC9DmxCGmP4o+M/Z/kHUew/9faHlCiLGxw==
  33. X-Google-Smtp-Source: AGHT+IFRXxBV6JuX5Cl/k2o1+WKkCwkR8j20MJSkmoGCedPAtqFttH8OVh1/6vdfnq8MPN++A2h89peZQhyG8OsJ8A==
  34. X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5])
  35. (user=justinstitt job=sendgmr) by 2002:a25:dac7:0:b0:da0:3117:f35 with SMTP
  36. id n190-20020a25dac7000000b00da031170f35mr28652ybf.3.1701904575576; Wed, 06
  37. Dec 2023 15:16:15 -0800 (PST)
  38. Date: Wed, 06 Dec 2023 23:16:10 +0000
  39. In-Reply-To: <[email protected]>
  40. Precedence: bulk
  41. X-Mailing-List: [email protected]
  42. List-Id: <bpf.vger.kernel.org>
  43. List-Subscribe: <mailto:[email protected]>
  44. List-Unsubscribe: <mailto:[email protected]>
  45. Mime-Version: 1.0
  46. References: <[email protected]>
  47. X-Developer-Key: [email protected]; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE=
  48. X-Developer-Signature: v=1; a=ed25519-sha256; t=1701904573; l=1840;
  49. [email protected]; s=20230717; h=from:subject:message-id;
  50. bh=UMdetIL2ZsPIkSodqhw2fM21NHJVjCu0lRImFuNhVoM=; b=a8rMnXfVVQ5gsxHWG4WRMwOLxZgflqXZtNuKx26vv4DwYvvCtCiYjl3f1frOjV/Ul2kaxq5g/
  51. b/UOv678JKCDASVokxG5GJifAnU7/kqRxdhcwfRkrD8RUfcsmiZOfyF
  52. X-Mailer: b4 0.12.3
  53. Message-ID: <[email protected]>
  54. Subject: [PATCH net-next v5 1/3] ethtool: Implement ethtool_puts()
  55. From: [email protected]
  56. To: "David S. Miller" <[email protected]>, Eric Dumazet <[email protected]>,
  57. Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>, Shay Agroskin <[email protected]>,
  58. Arthur Kiyanovski <[email protected]>, David Arinzon <[email protected]>, Noam Dagan <[email protected]>,
  59. Saeed Bishara <[email protected]>, Rasesh Mody <[email protected]>,
  60. Sudarsana Kalluru <[email protected]>, [email protected],
  61. Dimitris Michailidis <[email protected]>, Yisen Zhuang <[email protected]>,
  62. Salil Mehta <[email protected]>, Jesse Brandeburg <[email protected]>,
  63. Tony Nguyen <[email protected]>, Louis Peens <[email protected]>,
  64. Shannon Nelson <[email protected]>, Brett Creeley <[email protected]>, [email protected],
  65. "K. Y. Srinivasan" <[email protected]>, Haiyang Zhang <[email protected]>, Wei Liu <[email protected]>,
  66. Dexuan Cui <[email protected]>, Ronak Doshi <[email protected]>,
  67. VMware PV-Drivers Reviewers <[email protected]>, Andy Whitcroft <[email protected]>, Joe Perches <[email protected]>,
  68. Dwaipayan Ray <[email protected]>, Lukas Bulwahn <[email protected]>,
  69. Hauke Mehrtens <[email protected]>, Andrew Lunn <[email protected]>,
  70. Florian Fainelli <[email protected]>, Vladimir Oltean <[email protected]>,
  71. "=?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?=" <[email protected]>, Daniel Golle <[email protected]>,
  72. Landen Chao <[email protected]>, DENG Qingfang <[email protected]>,
  73. Sean Wang <[email protected]>, Matthias Brugger <[email protected]>,
  74. AngeloGioacchino Del Regno <[email protected]>,
  75. Linus Walleij <[email protected]>,
  76. "=?utf-8?q?Alvin_=C5=A0ipraga?=" <[email protected]>, Wei Fang <[email protected]>,
  77. Shenwei Wang <[email protected]>, Clark Wang <[email protected]>,
  78. NXP Linux Team <[email protected]>, Lars Povlsen <[email protected]>,
  79. Steen Hegelund <[email protected]>, Daniel Machon <[email protected]>,
  80. [email protected], Jiawen Wu <[email protected]>,
  81. Mengyuan Lou <[email protected]>, Heiner Kallweit <[email protected]>,
  82. Russell King <[email protected]>, Alexei Starovoitov <[email protected]>,
  83. Daniel Borkmann <[email protected]>, Jesper Dangaard Brouer <[email protected]>,
  84. John Fastabend <[email protected]>
  85. Cc: [email protected], [email protected],
  86. Nick Desaulniers <[email protected]>, Nathan Chancellor <[email protected]>,
  87. Kees Cook <[email protected]>, [email protected],
  88. [email protected], [email protected],
  89. [email protected], [email protected],
  90. [email protected], Justin Stitt <[email protected]>
  91. Content-Type: text/plain; charset="utf-8"
  92. Use strscpy() to implement ethtool_puts().
  93. Functionally the same as ethtool_sprintf() when it's used with two
  94. arguments or with just "%s" format specifier.
  95. Signed-off-by: Justin Stitt <[email protected]>
  96. ---
  97. include/linux/ethtool.h | 13 +++++++++++++
  98. net/ethtool/ioctl.c | 7 +++++++
  99. 2 files changed, 20 insertions(+)
  100. --- a/include/linux/ethtool.h
  101. +++ b/include/linux/ethtool.h
  102. @@ -1052,4 +1052,17 @@ static inline int ethtool_mm_frag_size_m
  103. * next string.
  104. */
  105. extern __printf(2, 3) void ethtool_sprintf(u8 **data, const char *fmt, ...);
  106. +
  107. +/**
  108. + * ethtool_puts - Write string to ethtool string data
  109. + * @data: Pointer to a pointer to the start of string to update
  110. + * @str: String to write
  111. + *
  112. + * Write string to *data without a trailing newline. Update *data
  113. + * to point at start of next string.
  114. + *
  115. + * Prefer this function to ethtool_sprintf() when given only
  116. + * two arguments or if @fmt is just "%s".
  117. + */
  118. +extern void ethtool_puts(u8 **data, const char *str);
  119. #endif /* _LINUX_ETHTOOL_H */
  120. --- a/net/ethtool/ioctl.c
  121. +++ b/net/ethtool/ioctl.c
  122. @@ -1991,6 +1991,13 @@ __printf(2, 3) void ethtool_sprintf(u8 *
  123. }
  124. EXPORT_SYMBOL(ethtool_sprintf);
  125. +void ethtool_puts(u8 **data, const char *str)
  126. +{
  127. + strscpy(*data, str, ETH_GSTRING_LEN);
  128. + *data += ETH_GSTRING_LEN;
  129. +}
  130. +EXPORT_SYMBOL(ethtool_puts);
  131. +
  132. static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
  133. {
  134. struct ethtool_value id;