Change in osmo-ci[master]: lint: checkpatch.pl: add STRCPY_OSMO

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Wed Sep 15 09:02:36 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/25466 )


Change subject: lint: checkpatch.pl: add STRCPY_OSMO
......................................................................

lint: checkpatch.pl: add STRCPY_OSMO

Add Osmocom specific check to forbid using strncpy() and strcpy().
Instead, osmo_strlcpy() or OSMO_STRLCPY_ARRAY() should be used.

Related: https://lists.osmocom.org/pipermail/openbsc/2021-September/013538.html
Change-Id: I6fa96c8f3d15110dd3d3509faa593285a78f469e
---
M lint/checkpatch/checkpatch.pl
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/66/25466/1

diff --git a/lint/checkpatch/checkpatch.pl b/lint/checkpatch/checkpatch.pl
index 059a2a6..3d09318 100755
--- a/lint/checkpatch/checkpatch.pl
+++ b/lint/checkpatch/checkpatch.pl
@@ -7201,6 +7201,12 @@
 			     "Where possible, use lockdep_assert_held instead of assertions based on spin_is_locked\n" . $herecurr);
 		}
 
+# Osmocom specific: check for strncpy(), strcpy()
+# https://lists.osmocom.org/pipermail/openbsc/2021-September/013538.html
+		if ($line =~ /\bstr(n)?cpy\(/) {
+			ERROR("STRCPY_OSMO","Instead of strncpy()/strcpy(), use osmo_strlcpy() or OSMO_STRLCPY_ARRAY()\n" . $herecurr);
+		}
+
 # check for deprecated apis
 		if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) {
 			my $deprecated_api = $1;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/25466
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I6fa96c8f3d15110dd3d3509faa593285a78f469e
Gerrit-Change-Number: 25466
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210915/72bab413/attachment.htm>


More information about the gerrit-log mailing list