forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from truenas/truenas/zfs-2.2.3-staging
[truenas/zfs-2.2-release]: sync with upstream zfs-2.2.3-staging
- Loading branch information
Showing
151 changed files
with
4,496 additions
and
485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: "Custom CodeQL Analysis" | ||
|
||
queries: | ||
- uses: ./.github/codeql/custom-queries/cpp/deprecatedFunctionUsage.ql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: "Custom CodeQL Analysis" | ||
|
||
paths-ignore: | ||
- tests |
59 changes: 59 additions & 0 deletions
59
.github/codeql/custom-queries/cpp/deprecatedFunctionUsage.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @name Deprecated function usage detection | ||
* @description Detects functions whose usage is banned from the OpenZFS | ||
* codebase due to QA concerns. | ||
* @kind problem | ||
* @severity error | ||
* @id cpp/deprecated-function-usage | ||
*/ | ||
|
||
import cpp | ||
|
||
predicate isDeprecatedFunction(Function f) { | ||
f.getName() = "strtok" or | ||
f.getName() = "__xpg_basename" or | ||
f.getName() = "basename" or | ||
f.getName() = "dirname" or | ||
f.getName() = "bcopy" or | ||
f.getName() = "bcmp" or | ||
f.getName() = "bzero" or | ||
f.getName() = "asctime" or | ||
f.getName() = "asctime_r" or | ||
f.getName() = "gmtime" or | ||
f.getName() = "localtime" or | ||
f.getName() = "strncpy" | ||
|
||
} | ||
|
||
string getReplacementMessage(Function f) { | ||
if f.getName() = "strtok" then | ||
result = "Use strtok_r(3) instead!" | ||
else if f.getName() = "__xpg_basename" then | ||
result = "basename(3) is underspecified. Use zfs_basename() instead!" | ||
else if f.getName() = "basename" then | ||
result = "basename(3) is underspecified. Use zfs_basename() instead!" | ||
else if f.getName() = "dirname" then | ||
result = "dirname(3) is underspecified. Use zfs_dirnamelen() instead!" | ||
else if f.getName() = "bcopy" then | ||
result = "bcopy(3) is deprecated. Use memcpy(3)/memmove(3) instead!" | ||
else if f.getName() = "bcmp" then | ||
result = "bcmp(3) is deprecated. Use memcmp(3) instead!" | ||
else if f.getName() = "bzero" then | ||
result = "bzero(3) is deprecated. Use memset(3) instead!" | ||
else if f.getName() = "asctime" then | ||
result = "Use strftime(3) instead!" | ||
else if f.getName() = "asctime_r" then | ||
result = "Use strftime(3) instead!" | ||
else if f.getName() = "gmtime" then | ||
result = "gmtime(3) isn't thread-safe. Use gmtime_r(3) instead!" | ||
else if f.getName() = "localtime" then | ||
result = "localtime(3) isn't thread-safe. Use localtime_r(3) instead!" | ||
else | ||
result = "strncpy(3) is deprecated. Use strlcpy(3) instead!" | ||
} | ||
|
||
from FunctionCall fc, Function f | ||
where | ||
fc.getTarget() = f and | ||
isDeprecatedFunction(f) | ||
select fc, getReplacementMessage(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: openzfs-cpp-queries | ||
version: 0.0.0 | ||
libraryPathDependencies: codeql-cpp | ||
suites: openzfs-cpp-suite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
Meta: 1 | ||
Name: zfs | ||
Branch: 1.0 | ||
Version: 2.2.2 | ||
Version: 2.2.3 | ||
Release: 1 | ||
Release-Tags: relext | ||
License: CDDL | ||
Author: OpenZFS | ||
Linux-Maximum: 6.6 | ||
Linux-Maximum: 6.7 | ||
Linux-Minimum: 3.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.