Skip to content
Snippets Groups Projects
Commit 860b2928 authored by Clemens Terasa's avatar Clemens Terasa
Browse files

imx6-spreadspectrum: Update and fix possible bufferoverflow.

Update to use the recent proc_ops.
Fix possible buffer overflow: The bounds were checked by the complaining
compiler, so I do not deserve credit.

Harmonize the recipes and Makefiles for imx6-spreadspectrum and
rtc-pcf8563-guf.

The imx6-spreadspectrum is still not installed by default for imx6(ull)
devices.

BCS 746-000453
parent b01a3ba2
No related branches found
No related tags found
1 merge request!112imx6[ull]guf: Add kernel-module-imx6-spreadspectrum
SUMMARY = "Kernel module to enable spread spectrum on IMX6"
HOMEPAGE = "https://garz-fricke.com"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
inherit module-base kernel-module-split
inherit module-base
inherit module
inherit kernel-module-split
SRC_URI = "file://Makefile \
file://imx6-spreadspectrum.c \
"
S = "${WORKDIR}"
do_configure_prepend () {
sed -i "s/SVNVERSION/${PV}/g" ${S}/Makefile
sed -i "s/SCMVERSION/${PV}/g" ${S}/Makefile
}
# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.
RPROVIDES_${PN} += "kernel-module-${PN}"
RRECOMMENDS_${PN} = "kernel-module-${PN}"
KERNEL_MODULE_AUTOLOAD += "${PN}"
......@@ -2,7 +2,7 @@ obj-m += imx6-spreadspectrum.o
SRC := $(shell pwd)
ccflags-y := $(ccflags-y) -D VERSION="\"SVNVERSION\""
ccflags-y := $(ccflags-y) -D VERSION="\"SCMVERSION\""
all:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
......
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
......@@ -220,7 +221,7 @@ static int imx6_spreadspectrum_read_proc(struct file *filp, char *buf, size_t co
if (ret >= PROC_FS_MAX_LEN) ret = PROC_FS_MAX_LEN;
count = ret;
ret = copy_to_user(buf, buffer, count + 1);
ret = copy_to_user(buf, buffer, count);
if (ret) goto error;
state = 1;
......@@ -230,10 +231,9 @@ error:
return ret;
}
static const struct file_operations imx6_spreadspectrum_fops = {
.owner = THIS_MODULE,
.read = imx6_spreadspectrum_read_proc,
.write = imx6_spreadspectrum_write_proc,
static const struct proc_ops imx6_spreadspectrum_fops = {
.proc_read = imx6_spreadspectrum_read_proc,
.proc_write = imx6_spreadspectrum_write_proc,
};
/* Function spreadsprectrum_create_proc_fs_entry:
......@@ -338,4 +338,6 @@ static void __exit imx6_spreadspectrum_exit(void)
module_init(imx6_spreadspectrum_init);
module_exit(imx6_spreadspectrum_exit);
MODULE_AUTHOR("Jonas Höppner <jonas.hoeppner@garz-fricke.com>");
MODULE_DESCRIPTION("Garz & Fricke iMX6 Spread Spectrum driver");
MODULE_LICENSE("GPL");
......@@ -4,24 +4,22 @@ HOMEPAGE = "https://garz-fricke.com"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
inherit module-base
inherit module-base
inherit module
inherit kernel-module-split
SRC_URI = "file://Makefile \
file://rtc-pcf8563-guf.c \
"
S = "${WORKDIR}"
do_configure_prepend () {
sed -i "s/SCMVERSION/${PV}/g" ${S}/Makefile
}
# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.
RPROVIDES_${PN} += "kernel-module-${PN}"
RRECOMMENDS_${PN} = "kernel-module-${PN}"
KERNEL_MODULE_AUTOLOAD += "${PN}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment