mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + lib-crc8-pointer-to-data-block-should-be-const.patch added to -mm tree
@ 2021-03-31  5:45 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-03-31  5:45 UTC (permalink / raw)
  To: mm-commits, rdunlap, rf


The patch titled
     Subject: lib: crc8: pointer to data block should be const
has been added to the -mm tree.  Its filename is
     lib-crc8-pointer-to-data-block-should-be-const.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/lib-crc8-pointer-to-data-block-should-be-const.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/lib-crc8-pointer-to-data-block-should-be-const.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Richard Fitzgerald <rf@opensource.cirrus.com>
Subject: lib: crc8: pointer to data block should be const

crc8() does not change the data passed to it, so the pointer argument
should be declared const.  This avoids callers that receive const data
having to cast it to a non-const pointer to call crc8().

Link: https://lkml.kernel.org/r/20210329122409.3291-1-rf@opensource.cirrus.com
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/crc8.h |    2 +-
 lib/crc8.c           |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/include/linux/crc8.h~lib-crc8-pointer-to-data-block-should-be-const
+++ a/include/linux/crc8.h
@@ -96,6 +96,6 @@ void crc8_populate_msb(u8 table[CRC8_TAB
  * Williams, Ross N., ross<at>ross.net
  * (see URL http://www.ross.net/crc/download/crc_v3.txt).
  */
-u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc);
+u8 crc8(const u8 table[CRC8_TABLE_SIZE], const u8 *pdata, size_t nbytes, u8 crc);
 
 #endif /* __CRC8_H_ */
--- a/lib/crc8.c~lib-crc8-pointer-to-data-block-should-be-const
+++ a/lib/crc8.c
@@ -71,7 +71,7 @@ EXPORT_SYMBOL(crc8_populate_lsb);
  * @nbytes: number of bytes in data buffer.
  * @crc: previous returned crc8 value.
  */
-u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc)
+u8 crc8(const u8 table[CRC8_TABLE_SIZE], const u8 *pdata, size_t nbytes, u8 crc)
 {
 	/* loop over the buffer data */
 	while (nbytes-- > 0)
_

Patches currently in -mm which might be from rf@opensource.cirrus.com are

lib-crc8-pointer-to-data-block-should-be-const.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-31  5:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  5:45 + lib-crc8-pointer-to-data-block-should-be-const.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).