The following issues were found

arch/x86/kernel/cpu/common.c
7 issues
Comparing pointers that point to different objects
Error

Line: 1368 CWE codes: 570

              	pr_info("KERNEL supported cpus:\n");
#endif

	for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) {
		const struct cpu_dev *cpudev = *cdev;

		if (count >= X86_VENDOR_NUM)
			break;
		cpu_devs[count] = cpudev;

            

Reported by Cppcheck.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 1580 Column: 4 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

              		const char *p;
		p = table_lookup_model(c);
		if (p)
			strcpy(c->x86_model_id, p);
		else
			/* Last resort... */
			sprintf(c->x86_model_id, "%02x/%02x",
				c->x86, c->x86_model);
	}

            

Reported by FlawFinder.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 101 Column: 4 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

              	if (c->cpuid_level == -1) {
		/* No cpuid. It must be an ancient CPU */
		if (c->x86 == 4)
			strcpy(c->x86_model_id, "486");
		else if (c->x86 == 3)
			strcpy(c->x86_model_id, "386");
	}
#endif
}

            

Reported by FlawFinder.

strcpy - Does not check for buffer overflows when copying to destination [MS-banned]
Security

Line: 103 Column: 4 CWE codes: 120
Suggestion: Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)

              		if (c->x86 == 4)
			strcpy(c->x86_model_id, "486");
		else if (c->x86 == 3)
			strcpy(c->x86_model_id, "386");
	}
#endif
}

static const struct cpu_dev default_cpu = {

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 1227 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

               */
static void __init cpu_parse_early_param(void)
{
	char arg[128];
	char *argptr = arg;
	int arglen, res, bit;

#ifdef CONFIG_X86_32
	if (cmdline_find_option_bool(boot_command_line, "no387"))

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 1583 Column: 4 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              			strcpy(c->x86_model_id, p);
		else
			/* Last resort... */
			sprintf(c->x86_model_id, "%02x/%02x",
				c->x86, c->x86_model);
	}

#ifdef CONFIG_X86_64
	detect_ht(c);

            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 449 Column: 6 CWE codes: 126

              static __init int x86_nofsgsbase_setup(char *arg)
{
	/* Require an exact match without trailing characters. */
	if (strlen(arg))
		return 0;

	/* Do not emit a message if the feature is not present. */
	if (!boot_cpu_has(X86_FEATURE_FSGSBASE))
		return 1;

            

Reported by FlawFinder.

block/elevator.c
7 issues
sprintf - Does not check for buffer overflows
Security

Line: 798 Column: 11 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              	spin_lock(&elv_list_lock);
	list_for_each_entry(__e, &elv_list, list) {
		if (elv && elevator_match(elv, __e->elevator_name, 0)) {
			len += sprintf(name+len, "[%s] ", elv->elevator_name);
			continue;
		}
		if (elv_support_iosched(q) &&
		    elevator_match(__e, __e->elevator_name,
				   q->required_elevator_features))

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 804 Column: 11 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              		if (elv_support_iosched(q) &&
		    elevator_match(__e, __e->elevator_name,
				   q->required_elevator_features))
			len += sprintf(name+len, "%s ", __e->elevator_name);
	}
	spin_unlock(&elv_list_lock);

	if (q->elevator)
		len += sprintf(name+len, "none");

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 735 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

               */
static int __elevator_change(struct request_queue *q, const char *name)
{
	char elevator_name[ELV_NAME_MAX];
	struct elevator_type *e;

	/* Make sure queue is not in the middle of being removed */
	if (!blk_queue_registered(q))
		return -ENOENT;

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 788 Column: 10 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              	int len = 0;

	if (!queue_is_mq(q))
		return sprintf(name, "none\n");

	if (!q->elevator)
		len += sprintf(name+len, "[none] ");
	else
		elv = e->type;

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 791 Column: 10 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              		return sprintf(name, "none\n");

	if (!q->elevator)
		len += sprintf(name+len, "[none] ");
	else
		elv = e->type;

	spin_lock(&elv_list_lock);
	list_for_each_entry(__e, &elv_list, list) {

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 809 Column: 10 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              	spin_unlock(&elv_list_lock);

	if (q->elevator)
		len += sprintf(name+len, "none");

	len += sprintf(len+name, "\n");
	return len;
}


            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 811 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              	if (q->elevator)
		len += sprintf(name+len, "none");

	len += sprintf(len+name, "\n");
	return len;
}

struct request *elv_rb_former_request(struct request_queue *q,
				      struct request *rq)

            

Reported by FlawFinder.

arch/x86/include/asm/mpspec_def.h
7 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 23 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
/* Intel MP Floating Pointer Structure */
struct mpf_intel {
	char signature[4];		/* "_MP_"			*/
	unsigned int physptr;		/* Configuration table address	*/
	unsigned char length;		/* Our length (paragraphs)	*/
	unsigned char specification;	/* Specification version	*/
	unsigned char checksum;		/* Checksum (makes sum 0)	*/
	unsigned char feature1;		/* Standard or configuration ?	*/

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 38 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              #define MPC_SIGNATURE "PCMP"

struct mpc_table {
	char signature[4];
	unsigned short length;		/* Size of table */
	char spec;			/* 0x01 */
	char checksum;
	char oem[8];
	char productid[12];

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 42 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              	unsigned short length;		/* Size of table */
	char spec;			/* 0x01 */
	char checksum;
	char oem[8];
	char productid[12];
	unsigned int oemptr;		/* 0 if not present */
	unsigned short oemsize;		/* 0 if not present */
	unsigned short oemcount;
	unsigned int lapic;		/* APIC address */

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 43 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              	char spec;			/* 0x01 */
	char checksum;
	char oem[8];
	char productid[12];
	unsigned int oemptr;		/* 0 if not present */
	unsigned short oemsize;		/* 0 if not present */
	unsigned short oemcount;
	unsigned int lapic;		/* APIC address */
	unsigned int reserved;

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 81 Column: 11 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              struct mpc_bus {
	unsigned char type;
	unsigned char busid;
	unsigned char bustype[6];
};

/* List of Bus Type string values, Intel MP Spec. */
#define BUSTYPE_EISA	"EISA"
#define BUSTYPE_ISA	"ISA"

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 158 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              #define MPC_OEM_SIGNATURE "_OEM"

struct mpc_oemtable {
	char signature[4];
	unsigned short length;		/* Size of table */
	char  rev;			/* 0x01 */
	char  checksum;
	char  mpc[8];
};

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 162 Column: 2 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              	unsigned short length;		/* Size of table */
	char  rev;			/* 0x01 */
	char  checksum;
	char  mpc[8];
};

/*
 *	Default configurations
 *

            

Reported by FlawFinder.

arch/csky/mm/tcm.c
7 issues
Subtracting pointers that point to different objects
Error

Line: 76 CWE codes: 570

              
#ifndef CONFIG_HAVE_DTCM
	memcpy((void *)__fix_to_virt(FIX_TCM),
				&__tcm_start, &__tcm_end - &__tcm_start);

	pr_info("%s: mapping tcm va:0x%08lx to pa:0x%08x\n",
			__func__, __fix_to_virt(FIX_TCM), CONFIG_ITCM_RAM_BASE);

	pr_info("%s: __tcm_start va:0x%08lx size:%d\n",

            

Reported by Cppcheck.

Subtracting pointers that point to different objects
Error

Line: 82 CWE codes: 570

              			__func__, __fix_to_virt(FIX_TCM), CONFIG_ITCM_RAM_BASE);

	pr_info("%s: __tcm_start va:0x%08lx size:%d\n",
			__func__, (unsigned long)&__tcm_start, &__tcm_end - &__tcm_start);
#else
	memcpy((void *)__fix_to_virt(FIX_TCM),
				&__tcm_start, &__dtcm_start - &__tcm_start);

	pr_info("%s: mapping itcm va:0x%08lx to pa:0x%08x\n",

            

Reported by Cppcheck.

Subtracting pointers that point to different objects
Error

Line: 134 CWE codes: 570

              {
#ifndef CONFIG_HAVE_DTCM
	u32 pool_size = (u32) (TCM_NR_PAGES * PAGE_SIZE)
				- (u32) (&__tcm_end - &__tcm_start);

	u32 tcm_pool_start = __fix_to_virt(FIX_TCM)
				+ (u32) (&__tcm_end - &__tcm_start);
#else
	u32 pool_size = (u32) (CONFIG_DTCM_NR_PAGES * PAGE_SIZE)

            

Reported by Cppcheck.

Subtracting pointers that point to different objects
Error

Line: 137 CWE codes: 570

              				- (u32) (&__tcm_end - &__tcm_start);

	u32 tcm_pool_start = __fix_to_virt(FIX_TCM)
				+ (u32) (&__tcm_end - &__tcm_start);
#else
	u32 pool_size = (u32) (CONFIG_DTCM_NR_PAGES * PAGE_SIZE)
				- (u32) (&__tcm_end - &__dtcm_start);

	u32 tcm_pool_start = __fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES)

            

Reported by Cppcheck.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 75 Column: 2 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              #endif

#ifndef CONFIG_HAVE_DTCM
	memcpy((void *)__fix_to_virt(FIX_TCM),
				&__tcm_start, &__tcm_end - &__tcm_start);

	pr_info("%s: mapping tcm va:0x%08lx to pa:0x%08x\n",
			__func__, __fix_to_virt(FIX_TCM), CONFIG_ITCM_RAM_BASE);


            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 84 Column: 2 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	pr_info("%s: __tcm_start va:0x%08lx size:%d\n",
			__func__, (unsigned long)&__tcm_start, &__tcm_end - &__tcm_start);
#else
	memcpy((void *)__fix_to_virt(FIX_TCM),
				&__tcm_start, &__dtcm_start - &__tcm_start);

	pr_info("%s: mapping itcm va:0x%08lx to pa:0x%08x\n",
			__func__, __fix_to_virt(FIX_TCM), CONFIG_ITCM_RAM_BASE);


            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 93 Column: 2 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	pr_info("%s: __itcm_start va:0x%08lx size:%d\n",
			__func__, (unsigned long)&__tcm_start, &__dtcm_start - &__tcm_start);

	memcpy((void *)__fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES),
				&__dtcm_start, &__tcm_end - &__dtcm_start);

	pr_info("%s: mapping dtcm va:0x%08lx to pa:0x%08x\n",
			__func__, __fix_to_virt(FIX_TCM - CONFIG_ITCM_NR_PAGES),
						CONFIG_DTCM_RAM_BASE);

            

Reported by FlawFinder.

arch/x86/events/intel/uncore.c
7 issues
sprintf - Does not check for buffer overflows
Security

Line: 119 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              {
	struct uncore_event_desc *event =
		container_of(attr, struct uncore_event_desc, attr);
	return sprintf(buf, "%s", event->config);
}

struct intel_uncore_box *uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
{
	unsigned int dieid = topology_logical_die_id(cpu);

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 865 Column: 4 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
	if (type->num_boxes == 1) {
		if (strlen(type->name) > 0)
			sprintf(pmu->name, "uncore_%s", type->name);
		else
			sprintf(pmu->name, "uncore");
	} else
		sprintf(pmu->name, "uncore_%s_%d", type->name, pmu->pmu_idx);


            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 869 Column: 3 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              		else
			sprintf(pmu->name, "uncore");
	} else
		sprintf(pmu->name, "uncore_%s_%d", type->name, pmu->pmu_idx);

}

static int uncore_pmu_register(struct intel_uncore_pmu *pmu)
{

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 855 Column: 4 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              	 */
	if (!type->name) {
		if (type->num_boxes == 1)
			sprintf(pmu->name, "uncore_type_%u", type->type_id);
		else {
			sprintf(pmu->name, "uncore_type_%u_%d",
				type->type_id, type->box_ids[pmu->pmu_idx]);
		}
		return;

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 857 Column: 4 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              		if (type->num_boxes == 1)
			sprintf(pmu->name, "uncore_type_%u", type->type_id);
		else {
			sprintf(pmu->name, "uncore_type_%u_%d",
				type->type_id, type->box_ids[pmu->pmu_idx]);
		}
		return;
	}


            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 867 Column: 4 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              		if (strlen(type->name) > 0)
			sprintf(pmu->name, "uncore_%s", type->name);
		else
			sprintf(pmu->name, "uncore");
	} else
		sprintf(pmu->name, "uncore_%s_%d", type->name, pmu->pmu_idx);

}


            

Reported by FlawFinder.

strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 864 Column: 7 CWE codes: 126

              	}

	if (type->num_boxes == 1) {
		if (strlen(type->name) > 0)
			sprintf(pmu->name, "uncore_%s", type->name);
		else
			sprintf(pmu->name, "uncore");
	} else
		sprintf(pmu->name, "uncore_%s_%d", type->name, pmu->pmu_idx);

            

Reported by FlawFinder.

block/blk-iocost.c
7 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 193 Column: 8 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              /* copied from TRACE_CGROUP_PATH, see cgroup-internal.h */
#define TRACE_IOCG_PATH_LEN 1024
static DEFINE_SPINLOCK(trace_iocg_path_lock);
static char trace_iocg_path[TRACE_IOCG_PATH_LEN];

#define TRACE_IOCG_PATH(type, iocg, ...)					\
	do {									\
		unsigned long flags;						\
		if (trace_iocost_##type##_enabled()) {				\

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 922 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	ioc->autop_too_slow_at = 0;

	if (!ioc->user_qos_params)
		memcpy(ioc->params.qos, p->qos, sizeof(p->qos));
	if (!ioc->user_cost_model)
		memcpy(ioc->params.i_lcoefs, p->i_lcoefs, sizeof(p->i_lcoefs));

	ioc_refresh_period_us(ioc);
	ioc_refresh_lcoefs(ioc);

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 924 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	if (!ioc->user_qos_params)
		memcpy(ioc->params.qos, p->qos, sizeof(p->qos));
	if (!ioc->user_cost_model)
		memcpy(ioc->params.i_lcoefs, p->i_lcoefs, sizeof(p->i_lcoefs));

	ioc_refresh_period_us(ioc);
	ioc_refresh_lcoefs(ioc);

	ioc->vrate_min = DIV64_U64_ROUND_UP((u64)ioc->params.qos[QOS_MIN] *

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 3189 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
	while ((p = strsep(&input, " \t\n"))) {
		substring_t args[MAX_OPT_ARGS];
		char buf[32];
		int tok;
		s64 v;

		if (!*p)
			continue;

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 3264 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	}

	if (user) {
		memcpy(ioc->params.qos, qos, sizeof(qos));
		ioc->user_qos_params = true;
	} else {
		ioc->user_qos_params = false;
	}


            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 3355 Column: 3 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
	while ((p = strsep(&input, " \t\n"))) {
		substring_t args[MAX_OPT_ARGS];
		char buf[32];
		int tok;
		u64 v;

		if (!*p)
			continue;

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 3390 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              
	spin_lock_irq(&ioc->lock);
	if (user) {
		memcpy(ioc->params.i_lcoefs, u, sizeof(u));
		ioc->user_cost_model = true;
	} else {
		ioc->user_cost_model = false;
	}
	ioc_refresh_params(ioc, true);

            

Reported by FlawFinder.

arch/ia64/kernel/topology.c
7 issues
sprintf - Does not check for buffer overflows
Security

Line: 194 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t show_attributes(struct cache_info *this_leaf, char *buf)
{
	return sprintf(buf,
			"%s\n",
			cache_mattrib[this_leaf->cci.pcci_cache_attr]);
}

static ssize_t show_size(struct cache_info *this_leaf, char *buf)

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 226 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              static ssize_t show_type(struct cache_info *this_leaf, char *buf)
{
	int type = this_leaf->type + this_leaf->cci.pcci_unified;
	return sprintf(buf, "%s\n", cache_types[type]);
}

static ssize_t show_level(struct cache_info *this_leaf, char *buf)
{
	return sprintf(buf, "%u\n", this_leaf->level);

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 183 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              static ssize_t show_coherency_line_size(struct cache_info *this_leaf,
					char *buf)
{
	return sprintf(buf, "%u\n", 1 << this_leaf->cci.pcci_line_size);
}

static ssize_t show_ways_of_associativity(struct cache_info *this_leaf,
					char *buf)
{

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 189 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              static ssize_t show_ways_of_associativity(struct cache_info *this_leaf,
					char *buf)
{
	return sprintf(buf, "%u\n", this_leaf->cci.pcci_assoc);
}

static ssize_t show_attributes(struct cache_info *this_leaf, char *buf)
{
	return sprintf(buf,

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 201 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t show_size(struct cache_info *this_leaf, char *buf)
{
	return sprintf(buf, "%uK\n", this_leaf->cci.pcci_cache_size / 1024);
}

static ssize_t show_number_of_sets(struct cache_info *this_leaf, char *buf)
{
	unsigned number_of_sets = this_leaf->cci.pcci_cache_size;

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 210 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              	number_of_sets /= this_leaf->cci.pcci_assoc;
	number_of_sets /= 1 << this_leaf->cci.pcci_line_size;

	return sprintf(buf, "%u\n", number_of_sets);
}

static ssize_t show_shared_cpu_map(struct cache_info *this_leaf, char *buf)
{
	cpumask_t shared_cpu_map;

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 231 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t show_level(struct cache_info *this_leaf, char *buf)
{
	return sprintf(buf, "%u\n", this_leaf->level);
}

struct cache_attr {
	struct attribute attr;
	ssize_t (*show)(struct cache_info *, char *);

            

Reported by FlawFinder.

arch/ia64/kernel/unwind.c
7 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 93 Column: 17 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              	unsigned long r0;			/* constant 0 for r0 */

	/* table of registers that prologues can save (and order in which they're saved): */
	const unsigned char save_order[8];

	/* maps a preserved register index (preg_index) to corresponding switch_stack offset: */
	unsigned short sw_off[sizeof(struct unw_frame_info) / 8];

	unsigned short lru_head;		/* index of lead-recently used script */

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 120 Column: 8 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              	struct unw_script cache[UNW_CACHE_SIZE];

# ifdef UNW_DEBUG
	const char *preg_name[UNW_NUM_REGS];
# endif
# if UNW_STATS
	struct {
		struct {
			int lookups;

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 625 Column: 2 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              		printk(KERN_ERR "unwind: cannot stack reg state!\n");
		return;
	}
	memcpy(rs, &sr->curr, sizeof(*rs));
	sr->curr.next = rs;
}

static void
pop (struct unw_state_record *sr)

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 638 Column: 2 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              		printk(KERN_ERR "unwind: stack underflow!\n");
		return;
	}
	memcpy(&sr->curr, rs, sizeof(*rs));
	free_reg_state(rs);
}

/* Make a copy of the state stack.  Non-recursive to avoid stack overflows.  */
static struct unw_reg_state *

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 654 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              			printk(KERN_ERR "unwind.dup_state_stack: out of memory\n");
			return NULL;
		}
		memcpy(copy, rs, sizeof(*copy));
		if (first)
			prev->next = copy;
		else
			first = copy;
		rs = rs->next;

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 773 Column: 25 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              	if (sr->imask) {
		unsigned char kind, mask = 0, *cp = sr->imask;
		int t;
		static const unsigned char limit[3] = {
			UNW_REG_F31, UNW_REG_R7, UNW_REG_B5
		};
		struct unw_reg_info *(regs[3]);

		regs[0] = sr->curr.reg + UNW_REG_F2;

            

Reported by FlawFinder.

memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 2231 Column: 3 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	for (entry = start; entry < end; ++entry, lp += 3) {
		info_size = 8 + 8*UNW_LENGTH(*(u64 *) (segbase + entry->info_offset));
		info -= info_size;
		memcpy(info, (char *) segbase + entry->info_offset, info_size);

		lp[0] = segbase + entry->start_offset;		/* start */
		lp[1] = segbase + entry->end_offset;		/* end */
		lp[2] = info - (char *) unw.gate_table;		/* info */
	}

            

Reported by FlawFinder.

block/blk-integrity.c
7 issues
sprintf - Does not check for buffer overflows
Security

Line: 251 Column: 10 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              static ssize_t integrity_format_show(struct blk_integrity *bi, char *page)
{
	if (bi->profile && bi->profile->name)
		return sprintf(page, "%s\n", bi->profile->name);
	else
		return sprintf(page, "none\n");
}

static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 253 Column: 10 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              	if (bi->profile && bi->profile->name)
		return sprintf(page, "%s\n", bi->profile->name);
	else
		return sprintf(page, "none\n");
}

static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%u\n", bi->tag_size);

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 258 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t integrity_tag_size_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%u\n", bi->tag_size);
}

static ssize_t integrity_interval_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%u\n",

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 263 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t integrity_interval_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%u\n",
		       bi->interval_exp ? 1 << bi->interval_exp : 0);
}

static ssize_t integrity_verify_store(struct blk_integrity *bi,
				      const char *page, size_t count)

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 283 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t integrity_verify_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_VERIFY) != 0);
}

static ssize_t integrity_generate_store(struct blk_integrity *bi,
					const char *page, size_t count)
{

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 302 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t integrity_generate_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 0);
}

static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%u\n",

            

Reported by FlawFinder.

sprintf - Does not check for buffer overflows
Security

Line: 307 Column: 9 CWE codes: 120
Suggestion: Use sprintf_s, snprintf, or vsnprintf

              
static ssize_t integrity_device_show(struct blk_integrity *bi, char *page)
{
	return sprintf(page, "%u\n",
		       (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) != 0);
}

static struct integrity_sysfs_entry integrity_format_entry = {
	.attr = { .name = "format", .mode = 0444 },

            

Reported by FlawFinder.

Documentation/sphinx/load_config.py
7 issues
Bad option value 'C0330'
Error

Line: 2 Column: 1

              # -*- coding: utf-8; mode: python -*-
# pylint: disable=R0903, C0330, R0914, R0912, E0401

import os
import sys
from sphinx.util.pycompat import execfile_

# ------------------------------------------------------------------------------
def loadConfig(namespace):

            

Reported by Pylint.

Redefining built-in 'dir'
Error

Line: 31 Column: 13

              
        end = config_file.rfind('/')
        if start >= 0 and end > 0:
            dir = config_file[start + 1:end]

            print("source directory: %s" % dir)
            new_latex_docs = []
            latex_documents = namespace['latex_documents']


            

Reported by Pylint.

Unused variable 'has'
Error

Line: 39 Column: 21

              
            for l in latex_documents:
                if l[0].find(dir + '/') == 0:
                    has = True
                    fn = l[0][len(dir) + 1:]
                    new_latex_docs.append((fn, l[1], l[2], l[3], l[4]))
                    break

            namespace['latex_documents'] = new_latex_docs

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # -*- coding: utf-8; mode: python -*-
# pylint: disable=R0903, C0330, R0914, R0912, E0401

import os
import sys
from sphinx.util.pycompat import execfile_

# ------------------------------------------------------------------------------
def loadConfig(namespace):

            

Reported by Pylint.

Function name "loadConfig" doesn't conform to snake_case naming style
Error

Line: 9 Column: 1

              from sphinx.util.pycompat import execfile_

# ------------------------------------------------------------------------------
def loadConfig(namespace):
# ------------------------------------------------------------------------------

    u"""Load an additional configuration file into *namespace*.

    The name of the configuration file is taken from the environment

            

Reported by Pylint.

Variable name "l" doesn't conform to snake_case naming style
Error

Line: 37 Column: 17

                          new_latex_docs = []
            latex_documents = namespace['latex_documents']

            for l in latex_documents:
                if l[0].find(dir + '/') == 0:
                    has = True
                    fn = l[0][len(dir) + 1:]
                    new_latex_docs.append((fn, l[1], l[2], l[3], l[4]))
                    break

            

Reported by Pylint.

Variable name "fn" doesn't conform to snake_case naming style
Error

Line: 40 Column: 21

                          for l in latex_documents:
                if l[0].find(dir + '/') == 0:
                    has = True
                    fn = l[0][len(dir) + 1:]
                    new_latex_docs.append((fn, l[1], l[2], l[3], l[4]))
                    break

            namespace['latex_documents'] = new_latex_docs


            

Reported by Pylint.