The following issues were found
Documentation/sphinx/rstFlatTable.py
66 issues
Line: 3
Column: 1
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# pylint: disable=C0330, R0903, R0912
u"""
flat-table
~~~~~~~~~~
Implementation of the ``flat-table`` reST-directive.
Reported by Pylint.
Line: 45
Column: 1
# imports
# ==============================================================================
from docutils import nodes
from docutils.parsers.rst import directives, roles
from docutils.parsers.rst.directives.tables import Table
from docutils.utils import SystemMessagePropagation
# ==============================================================================
Reported by Pylint.
Line: 46
Column: 1
# ==============================================================================
from docutils import nodes
from docutils.parsers.rst import directives, roles
from docutils.parsers.rst.directives.tables import Table
from docutils.utils import SystemMessagePropagation
# ==============================================================================
# common globals
Reported by Pylint.
Line: 47
Column: 1
from docutils import nodes
from docutils.parsers.rst import directives, roles
from docutils.parsers.rst.directives.tables import Table
from docutils.utils import SystemMessagePropagation
# ==============================================================================
# common globals
# ==============================================================================
Reported by Pylint.
Line: 48
Column: 1
from docutils import nodes
from docutils.parsers.rst import directives, roles
from docutils.parsers.rst.directives.tables import Table
from docutils.utils import SystemMessagePropagation
# ==============================================================================
# common globals
# ==============================================================================
Reported by Pylint.
Line: 163
Column: 3
for colwidth in colwidths:
colspec = nodes.colspec(colwidth=colwidth)
# FIXME: It seems, that the stub method only works well in the
# absence of rowspan (observed by the html builder, the docutils-xml
# build seems OK). This is not extraordinary, because there exists
# no table directive (except *this* flat-table) which allows to
# define coexistent of rowspan and stubs (there was no use-case
# before flat-table). This should be reviewed (later).
Reported by Pylint.
Line: 291
Column: 21
cspan, rspan, content = row[-1]
row[-1] = (cspan + x, rspan, content)
elif x and fill_cells:
for i in range(x):
row.append( (0, 0, nodes.comment()) )
def pprint(self):
# for debugging
retVal = "[ "
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# pylint: disable=C0330, R0903, R0912
u"""
flat-table
~~~~~~~~~~
Implementation of the ``flat-table`` reST-directive.
Reported by Pylint.
Line: 57
Column: 1
__version__ = '1.0'
# ==============================================================================
def setup(app):
# ==============================================================================
app.add_directive("flat-table", FlatTable)
roles.register_local_role('cspan', c_span)
roles.register_local_role('rspan', r_span)
Reported by Pylint.
Line: 71
Column: 1
)
# ==============================================================================
def c_span(name, rawtext, text, lineno, inliner, options=None, content=None):
# ==============================================================================
# pylint: disable=W0613
options = options if options is not None else {}
content = content if content is not None else []
Reported by Pylint.
arch/s390/kernel/ipl.c
66 issues
Line: 238
Column: 6
CWE codes:
120
20
Suggestion:
Specify a limit to %s, or use a different input function
const char *buf, size_t len) \
{ \
unsigned long long value; \
if (sscanf(buf, _fmt_in, &value) != 1) \
return -EINVAL; \
_value = value; \
return len; \
} \
static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
Reported by FlawFinder.
Line: 295
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
static ssize_t ipl_type_show(struct kobject *kobj, struct kobj_attribute *attr,
char *page)
{
return sprintf(page, "%s\n", ipl_type_str(ipl_info.type));
}
static struct kobj_attribute sys_ipl_type_attr = __ATTR_RO(ipl_type);
static ssize_t ipl_secure_show(struct kobject *kobj,
Reported by FlawFinder.
Line: 325
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
if (ipl_block_valid && (ipl_block.pb0_hdr.pbt == IPL_PBT_CCW))
ipl_block_get_ascii_vmparm(parm, sizeof(parm), &ipl_block);
return sprintf(page, "%s\n", parm);
}
static struct kobj_attribute sys_ipl_vm_parm_attr =
__ATTR(parm, S_IRUGO, ipl_vm_parm_show, NULL);
Reported by FlawFinder.
Line: 432
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
memcpy(loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN);
EBCASC(loadparm, LOADPARM_LEN);
strim(loadparm);
return sprintf(page, "%s\n", loadparm);
}
static struct kobj_attribute sys_ipl_ccw_loadparm_attr =
__ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL);
Reported by FlawFinder.
Line: 582
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
char vmparm[DIAG308_VMPARM_SIZE + 1] = {};
ipl_block_get_ascii_vmparm(vmparm, sizeof(vmparm), ipb);
return sprintf(page, "%s\n", vmparm);
}
static ssize_t reipl_generic_vmparm_store(struct ipl_parameter_block *ipb,
size_t vmparm_max,
const char *buf, size_t len)
Reported by FlawFinder.
Line: 724
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
char buf[LOADPARM_LEN + 1];
reipl_get_ascii_loadparm(buf, ipb);
return sprintf(page, "%s\n", buf);
}
static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb,
const char *buf, size_t len)
{
Reported by FlawFinder.
Line: 1005
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
char nss_name[NSS_NAME_SIZE + 1] = {};
reipl_get_ascii_nss_name(nss_name, reipl_block_nss);
return sprintf(page, "%s\n", nss_name);
}
static ssize_t reipl_nss_name_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
Reported by FlawFinder.
Line: 1091
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
static ssize_t reipl_type_show(struct kobject *kobj,
struct kobj_attribute *attr, char *page)
{
return sprintf(page, "%s\n", ipl_type_str(reipl_type));
}
static ssize_t reipl_type_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
Reported by FlawFinder.
Line: 1487
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
static ssize_t dump_type_show(struct kobject *kobj,
struct kobj_attribute *attr, char *page)
{
return sprintf(page, "%s\n", dump_type_str(dump_type));
}
static ssize_t dump_type_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
Reported by FlawFinder.
Line: 1781
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
static ssize_t on_reboot_show(struct kobject *kobj,
struct kobj_attribute *attr, char *page)
{
return sprintf(page, "%s\n", on_reboot_trigger.action->name);
}
static ssize_t on_reboot_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t len)
Reported by FlawFinder.
net/wireless/trace.h
65 issues
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
Line: 3216
__field(u64, scan_start_tsf)
MAC_ENTRY(tsf_bssid)
),
TP_fast_assign(
if (request) {
memcpy(__get_dynamic_array(ie), request->ie,
request->ie_len);
memcpy(__entry->rates, request->rates,
NUM_NL80211_BANDS);
Reported by Cppcheck.
tools/testing/selftests/tpm2/tpm2.py
64 issues
Line: 207
Column: 27
self.alg = alg
def __str__(self):
return '0x%0x' % (alg)
class UnknownAlgorithmNameError(Exception):
def __init__(self, name):
self.name = name
Reported by Pylint.
Line: 215
Column: 16
self.name = name
def __str__(self):
return name
class UnknownPCRBankError(Exception):
def __init__(self, alg):
self.alg = alg
Reported by Pylint.
Line: 223
Column: 27
self.alg = alg
def __str__(self):
return '0x%0x' % (alg)
class ProtocolError(Exception):
def __init__(self, cc, rc):
self.cc = cc
Reported by Pylint.
Line: 5
Column: 1
import hashlib
import os
import socket
import struct
import sys
import unittest
import fcntl
import select
Reported by Pylint.
Line: 8
Column: 1
import socket
import struct
import sys
import unittest
import fcntl
import select
TPM2_ST_NO_SESSIONS = 0x8001
TPM2_ST_SESSIONS = 0x8002
Reported by Pylint.
Line: 203
Column: 5
class UnknownAlgorithmIdError(Exception):
def __init__(self, alg):
self.alg = alg
def __str__(self):
return '0x%0x' % (alg)
Reported by Pylint.
Line: 211
Column: 5
class UnknownAlgorithmNameError(Exception):
def __init__(self, name):
self.name = name
def __str__(self):
return name
Reported by Pylint.
Line: 219
Column: 5
class UnknownPCRBankError(Exception):
def __init__(self, alg):
self.alg = alg
def __str__(self):
return '0x%0x' % (alg)
Reported by Pylint.
Line: 227
Column: 5
class ProtocolError(Exception):
def __init__(self, cc, rc):
self.cc = cc
self.rc = rc
if (rc & RC_FMT1) == RC_FMT1:
self.name = TPM2_FMT1_ERRORS.get(rc & 0x3f, "TPM_RC_UNKNOWN")
Reported by Pylint.
Line: 418
Column: 9
rsp = self.send_cmd(cmd)
pcr_update_cnt, pcr_select_cnt = struct.unpack('>II', rsp[10:18])
assert pcr_select_cnt == 1
rsp = rsp[18:]
alg2, pcrsel_len2 = struct.unpack('>HB', rsp[:3])
assert bank_alg == alg2 and pcrsel_len == pcrsel_len2
Reported by Pylint.
tools/perf/scripts/python/syscall-counts.py
64 issues
Line: 16
Column: 1
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts.py [comm]\n";
Reported by Pylint.
Line: 17
Column: 1
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts.py [comm]\n";
for_comm = None
Reported by Pylint.
Line: 18
Column: 1
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts.py [comm]\n";
for_comm = None
Reported by Pylint.
Line: 30
Column: 12
if len(sys.argv) > 1:
for_comm = sys.argv[1]
syscalls = autodict()
def trace_begin():
print("Press control+C to stop and show the summary")
def trace_end():
Reported by Pylint.
Line: 16
Column: 1
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts.py [comm]\n";
Reported by Pylint.
Line: 17
Column: 1
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts.py [comm]\n";
for_comm = None
Reported by Pylint.
Line: 20
Column: 1
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts.py [comm]\n";
for_comm = None
if len(sys.argv) > 2:
sys.exit(usage)
Reported by Pylint.
Line: 38
Column: 41
def trace_end():
print_syscall_totals()
def raw_syscalls__sys_enter(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, id, args):
if for_comm is not None:
if common_comm != for_comm:
return
Reported by Pylint.
Line: 38
Column: 50
def trace_end():
print_syscall_totals()
def raw_syscalls__sys_enter(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, id, args):
if for_comm is not None:
if common_comm != for_comm:
return
Reported by Pylint.
Line: 38
Column: 29
def trace_end():
print_syscall_totals()
def raw_syscalls__sys_enter(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, id, args):
if for_comm is not None:
if common_comm != for_comm:
return
Reported by Pylint.
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
63 issues
Line: 334
Column: 36
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
struct ieee80211_crypt_data *crypt)
{
struct rtl_80211_hdr_4addr *hdr;
int res, hdrlen;
if (!crypt || !crypt->ops->decrypt_mpdu)
Reported by FlawFinder.
Line: 339
Column: 7
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
struct rtl_80211_hdr_4addr *hdr;
int res, hdrlen;
if (!crypt || !crypt->ops->decrypt_mpdu)
return 0;
if (ieee->hwsec_active) {
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
tcb_desc->bHwSec = 1;
}
Reported by FlawFinder.
Line: 380
Column: 50
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
/* Called only as a tasklet (software IRQ), by ieee80211_rx */
static inline int
ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *skb,
int keyidx, struct ieee80211_crypt_data *crypt)
{
struct rtl_80211_hdr_4addr *hdr;
int res, hdrlen;
if (!crypt || !crypt->ops->decrypt_msdu)
Reported by FlawFinder.
Line: 385
Column: 7
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
struct rtl_80211_hdr_4addr *hdr;
int res, hdrlen;
if (!crypt || !crypt->ops->decrypt_msdu)
return 0;
if (ieee->hwsec_active) {
struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
tcb_desc->bHwSec = 1;
}
Reported by FlawFinder.
Line: 964
Column: 17
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
int idx = 0;
if (skb->len >= hdrlen + 3)
idx = skb->data[hdrlen + 3] >> 6;
crypt = ieee->crypt[idx];
#ifdef NOT_YET
sta = NULL;
/* Use station specific key to override default keys if the
* receiver address is a unicast address ("individual RA"). If
Reported by FlawFinder.
Line: 976
Column: 48
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
* stations that do not support WEP key mapping). */
if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key)
(void)hostap_handle_sta_crypto(local, hdr, &crypt,
&sta);
#endif
/* allow NULL decrypt to indicate an station specific override
* for default encryption */
Reported by FlawFinder.
Line: 982
Column: 7
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
/* allow NULL decrypt to indicate an station specific override
* for default encryption */
if (crypt && (!crypt->ops || !crypt->ops->decrypt_mpdu))
crypt = NULL;
if (!crypt && (fc & IEEE80211_FCTL_WEP)) {
/* This seems to be triggered by some (multicast?)
* frames from other than current BSS, so just drop the
Reported by FlawFinder.
Line: 985
Column: 8
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
if (crypt && (!crypt->ops || !crypt->ops->decrypt_mpdu))
crypt = NULL;
if (!crypt && (fc & IEEE80211_FCTL_WEP)) {
/* This seems to be triggered by some (multicast?)
* frames from other than current BSS, so just drop the
* frames silently instead of filling system log with
* these reports. */
IEEE80211_DEBUG_DROP("Decryption failed (not set)"
Reported by FlawFinder.
Line: 1123
Column: 54
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
(keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) {
netdev_dbg(ieee->dev, "decrypt frame error\n");
goto rx_dropped;
}
Reported by FlawFinder.
Line: 1187
Column: 57
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
/* skb: hdr + (possible reassembled) full MSDU payload; possibly still
* encrypted/authenticated */
if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) &&
ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) {
netdev_dbg(ieee->dev, "==>decrypt msdu error\n");
goto rx_dropped;
}
//added by amy for AP roaming
Reported by FlawFinder.
tools/perf/builtin-script.c
63 issues
Line: 874
Column: 14
CWE codes:
134
Suggestion:
Use a constant for the format specification
thread__find_map_fb(thread, sample->cpumode, to, &alt);
}
printed += fprintf(fp, " 0x%"PRIx64, from);
if (PRINT_FIELD(DSO)) {
printed += fprintf(fp, "(");
printed += map__fprintf_dsoname(alf.map, fp);
printed += fprintf(fp, ")");
}
Reported by FlawFinder.
Line: 881
Column: 14
CWE codes:
134
Suggestion:
Use a constant for the format specification
printed += fprintf(fp, ")");
}
printed += fprintf(fp, "/0x%"PRIx64, to);
if (PRINT_FIELD(DSO)) {
printed += fprintf(fp, "(");
printed += map__fprintf_dsoname(alt.map, fp);
printed += fprintf(fp, ")");
}
Reported by FlawFinder.
Line: 972
Column: 14
CWE codes:
134
Suggestion:
Use a constant for the format specification
!alt.map->dso->adjust_symbols)
to = map__map_ip(alt.map, to);
printed += fprintf(fp, " 0x%"PRIx64, from);
if (PRINT_FIELD(DSO)) {
printed += fprintf(fp, "(");
printed += map__fprintf_dsoname(alf.map, fp);
printed += fprintf(fp, ")");
}
Reported by FlawFinder.
Line: 978
Column: 14
CWE codes:
134
Suggestion:
Use a constant for the format specification
printed += map__fprintf_dsoname(alf.map, fp);
printed += fprintf(fp, ")");
}
printed += fprintf(fp, "/0x%"PRIx64, to);
if (PRINT_FIELD(DSO)) {
printed += fprintf(fp, "(");
printed += map__fprintf_dsoname(alt.map, fp);
printed += fprintf(fp, ")");
}
Reported by FlawFinder.
Line: 1316
Column: 16
CWE codes:
134
Suggestion:
Use a constant for the format specification
struct perf_event_attr *attr, FILE *fp)
{
struct addr_location al;
int printed = fprintf(fp, "%16" PRIx64, sample->addr);
if (!sample_addr_correlates_sym(attr))
goto out;
thread__resolve(thread, &al, sample);
Reported by FlawFinder.
Line: 1403
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (name)
len = fprintf(fp, "%*s%s", (int)depth * 4, "", name);
else if (ip)
len = fprintf(fp, "%*s%16" PRIx64, (int)depth * 4, "", ip);
if (len < 0)
return len;
/*
Reported by FlawFinder.
Line: 1800
Column: 8
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (perf_sample__bad_synth_size(sample, *data))
return 0;
len = fprintf(fp, " psb offs: %#" PRIx64, data->offset);
return len + perf_sample__fprintf_pt_spacing(len, fp);
}
static int perf_sample__fprintf_synth(struct perf_sample *sample,
struct evsel *evsel, FILE *fp)
Reported by FlawFinder.
Line: 1882
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
if (color)
color_fprintf(mctx->fp, color, fmt, val);
else
printf(fmt, val);
fprintf(mctx->fp, " %s\n", unit);
}
static void script_new_line(struct perf_stat_config *config __maybe_unused,
void *ctx)
Reported by FlawFinder.
Line: 2038
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
data_src__fprintf(sample->data_src, fp);
if (PRINT_FIELD(WEIGHT))
fprintf(fp, "%16" PRIu64, sample->weight);
if (PRINT_FIELD(IP)) {
struct callchain_cursor *cursor = NULL;
if (script->stitch_lbr)
Reported by FlawFinder.
Line: 2074
Column: 3
CWE codes:
134
Suggestion:
Use a constant for the format specification
perf_sample__fprintf_insn(sample, attr, thread, machine, fp);
if (PRINT_FIELD(PHYS_ADDR))
fprintf(fp, "%16" PRIx64, sample->phys_addr);
if (PRINT_FIELD(DATA_PAGE_SIZE))
fprintf(fp, " %s", get_page_size_name(sample->data_page_size, str));
if (PRINT_FIELD(CODE_PAGE_SIZE))
Reported by FlawFinder.
drivers/scsi/lpfc/lpfc_els.c
62 issues
Line: 4463
CWE codes:
476
list_remove_head(&buf_ptr1->list, buf_ptr,
struct lpfc_dmabuf,
list);
lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys);
kfree(buf_ptr);
}
lpfc_mbuf_free(phba, buf_ptr1->virt, buf_ptr1->phys);
kfree(buf_ptr1);
return 0;
Reported by Cppcheck.
Line: 506
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
rc = -ENOMEM;
goto fail;
}
memcpy(dmabuf->virt, &phba->fc_fabparam,
sizeof(struct serv_parm));
}
vport->port_state = LPFC_FABRIC_CFG_LINK;
if (dmabuf)
Reported by FlawFinder.
Line: 693
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
vport->fc_myDID = irsp->un.ulpWord[4] & Mask_DID;
memcpy(&ndlp->nlp_portname, &sp->portName, sizeof(struct lpfc_name));
memcpy(&ndlp->nlp_nodename, &sp->nodeName, sizeof(struct lpfc_name));
ndlp->nlp_class_sup = 0;
if (sp->cls1.classValid)
ndlp->nlp_class_sup |= FC_COS_CLASS1;
if (sp->cls2.classValid)
Reported by FlawFinder.
Line: 694
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
vport->fc_myDID = irsp->un.ulpWord[4] & Mask_DID;
memcpy(&ndlp->nlp_portname, &sp->portName, sizeof(struct lpfc_name));
memcpy(&ndlp->nlp_nodename, &sp->nodeName, sizeof(struct lpfc_name));
ndlp->nlp_class_sup = 0;
if (sp->cls1.classValid)
ndlp->nlp_class_sup |= FC_COS_CLASS1;
if (sp->cls2.classValid)
ndlp->nlp_class_sup |= FC_COS_CLASS2;
Reported by FlawFinder.
Line: 724
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
}
memcpy(&vport->fabric_portname, &sp->portName,
sizeof(struct lpfc_name));
memcpy(&vport->fabric_nodename, &sp->nodeName,
sizeof(struct lpfc_name));
memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm));
Reported by FlawFinder.
Line: 726
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
}
memcpy(&vport->fabric_portname, &sp->portName,
sizeof(struct lpfc_name));
memcpy(&vport->fabric_nodename, &sp->nodeName,
sizeof(struct lpfc_name));
memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm));
if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) {
if (sp->cmn.response_multiple_NPort) {
Reported by FlawFinder.
Line: 728
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
sizeof(struct lpfc_name));
memcpy(&vport->fabric_nodename, &sp->nodeName,
sizeof(struct lpfc_name));
memcpy(&phba->fc_fabparam, sp, sizeof(struct serv_parm));
if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) {
if (sp->cmn.response_multiple_NPort) {
lpfc_printf_vlog(vport, KERN_WARNING,
LOG_ELS | LOG_VPORT,
Reported by FlawFinder.
Line: 919
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
goto fail;
}
memcpy(&ndlp->nlp_portname, &sp->portName,
sizeof(struct lpfc_name));
memcpy(&ndlp->nlp_nodename, &sp->nodeName,
sizeof(struct lpfc_name));
/* Set state will put ndlp onto node list if not already done */
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
Reported by FlawFinder.
Line: 921
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
memcpy(&ndlp->nlp_portname, &sp->portName,
sizeof(struct lpfc_name));
memcpy(&ndlp->nlp_nodename, &sp->nodeName,
sizeof(struct lpfc_name));
/* Set state will put ndlp onto node list if not already done */
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
Reported by FlawFinder.
Line: 1309
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/* For FLOGI request, remainder of payload is service parameters */
*((uint32_t *) (pcmd)) = ELS_CMD_FLOGI;
pcmd += sizeof(uint32_t);
memcpy(pcmd, &vport->fc_sparam, sizeof(struct serv_parm));
sp = (struct serv_parm *) pcmd;
/* Setup CSPs accordingly for Fabric */
sp->cmn.e_d_tov = 0;
sp->cmn.w2.r_a_tov = 0;
Reported by FlawFinder.
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
62 issues
Line: 54
Column: 2
audit_package_warned = False
try:
import audit
machine_to_id = {
'x86_64': audit.MACH_86_64,
'alpha' : audit.MACH_ALPHA,
'ia64' : audit.MACH_IA64,
'ppc' : audit.MACH_PPC,
Reported by Pylint.
Line: 23
Column: 17
def avg(total, n):
return total / n
def nsecs(secs, nsecs):
return secs * NSECS_PER_SEC + nsecs
def nsecs_secs(nsecs):
return nsecs / NSECS_PER_SEC
Reported by Pylint.
Line: 26
Column: 16
def nsecs(secs, nsecs):
return secs * NSECS_PER_SEC + nsecs
def nsecs_secs(nsecs):
return nsecs / NSECS_PER_SEC
def nsecs_nsecs(nsecs):
return nsecs % NSECS_PER_SEC
Reported by Pylint.
Line: 29
Column: 17
def nsecs_secs(nsecs):
return nsecs / NSECS_PER_SEC
def nsecs_nsecs(nsecs):
return nsecs % NSECS_PER_SEC
def nsecs_str(nsecs):
str = "%5u.%09u" % (nsecs_secs(nsecs), nsecs_nsecs(nsecs)),
return str
Reported by Pylint.
Line: 32
Column: 15
def nsecs_nsecs(nsecs):
return nsecs % NSECS_PER_SEC
def nsecs_str(nsecs):
str = "%5u.%09u" % (nsecs_secs(nsecs), nsecs_nsecs(nsecs)),
return str
def add_stats(dict, key, value):
if key not in dict:
Reported by Pylint.
Line: 33
Column: 5
return nsecs % NSECS_PER_SEC
def nsecs_str(nsecs):
str = "%5u.%09u" % (nsecs_secs(nsecs), nsecs_nsecs(nsecs)),
return str
def add_stats(dict, key, value):
if key not in dict:
dict[key] = (value, value, value, 1)
Reported by Pylint.
Line: 36
Column: 15
str = "%5u.%09u" % (nsecs_secs(nsecs), nsecs_nsecs(nsecs)),
return str
def add_stats(dict, key, value):
if key not in dict:
dict[key] = (value, value, value, 1)
else:
min, max, avg, count = dict[key]
if value < min:
Reported by Pylint.
Line: 40
Column: 3
if key not in dict:
dict[key] = (value, value, value, 1)
else:
min, max, avg, count = dict[key]
if value < min:
min = value
if value > max:
max = value
avg = (avg + value) / 2
Reported by Pylint.
Line: 40
Column: 8
if key not in dict:
dict[key] = (value, value, value, 1)
else:
min, max, avg, count = dict[key]
if value < min:
min = value
if value > max:
max = value
avg = (avg + value) / 2
Reported by Pylint.
Line: 40
Column: 13
if key not in dict:
dict[key] = (value, value, value, 1)
else:
min, max, avg, count = dict[key]
if value < min:
min = value
if value > max:
max = value
avg = (avg + value) / 2
Reported by Pylint.
scripts/gdb/linux/proc.py
61 issues
Line: 14
Column: 1
# This work is licensed under the terms of the GNU GPL version 2.
#
import gdb
from linux import constants
from linux import utils
from linux import tasks
from linux import lists
from struct import *
Reported by Pylint.
Line: 15
Column: 1
#
import gdb
from linux import constants
from linux import utils
from linux import tasks
from linux import lists
from struct import *
Reported by Pylint.
Line: 19
Column: 1
from linux import utils
from linux import tasks
from linux import lists
from struct import *
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
Reported by Pylint.
Line: 19
Column: 1
from linux import utils
from linux import tasks
from linux import lists
from struct import *
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
Reported by Pylint.
Line: 19
Column: 1
from linux import utils
from linux import tasks
from linux import lists
from struct import *
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
Reported by Pylint.
Line: 19
Column: 1
from linux import utils
from linux import tasks
from linux import lists
from struct import *
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
Reported by Pylint.
Line: 19
Column: 1
from linux import utils
from linux import tasks
from linux import lists
from struct import *
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
Reported by Pylint.
Line: 19
Column: 1
from linux import utils
from linux import tasks
from linux import lists
from struct import *
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
Reported by Pylint.
Line: 19
Column: 1
from linux import utils
from linux import tasks
from linux import lists
from struct import *
class LxCmdLine(gdb.Command):
""" Report the Linux Commandline used in the current kernel.
Equivalent to cat /proc/cmdline on a running target"""
Reported by Pylint.
Line: 29
Column: 22
def __init__(self):
super(LxCmdLine, self).__init__("lx-cmdline", gdb.COMMAND_DATA)
def invoke(self, arg, from_tty):
gdb.write(gdb.parse_and_eval("saved_command_line").string() + "\n")
LxCmdLine()
Reported by Pylint.