From: Miroslav Ondra Date: Wed, 31 Oct 2018 01:41:41 +0000 (+0100) Subject: fixed null pointer dereference with loading module on system with no unipi board X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=101fa10cadd36c26714abcf1873722496d475435;p=graphit%2Funipi-kernel.git fixed null pointer dereference with loading module on system with no unipi board --- diff --git a/debian/changelog b/debian/changelog index 158be87..5c73809 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ unipi-kernel-modules (1.18) unstable; urgency=medium + * disabled long spi tranfer * added missing dummy method for reading secondary analog output -- Miroslav Ondra Mon, 16 Oct 2018 15:08:40 +0200 diff --git a/debian/neuron-kernel.changelog b/debian/neuron-kernel.changelog index 18d2222..29df870 100644 --- a/debian/neuron-kernel.changelog +++ b/debian/neuron-kernel.changelog @@ -1,3 +1,16 @@ +unipi-kernel-modules (1.18.1.20180924-1) unstable; urgency=medium + + * Compiled for raspberrypi-kernel 1.20180924-1 + + -- Miroslav Ondra Fri, 19 Oct 2018 10:09:57 +0200 + +unipi-kernel-modules (1.18) unstable; urgency=medium + + * disabled long spi tranfer + * added missing dummy method for reading secondary analog output + + -- Miroslav Ondra Mon, 16 Oct 2018 15:08:40 +0200 + unipi-kernel-modules (1.17.1.20180924-1) unstable; urgency=medium * Compiled for raspberrypi-kernel 1.20180924-1 diff --git a/modules/unipi/src/unipi_common.h b/modules/unipi/src/unipi_common.h index 6f5fc4a..7628fb8 100644 --- a/modules/unipi/src/unipi_common.h +++ b/modules/unipi/src/unipi_common.h @@ -51,7 +51,7 @@ #if NEURONSPI_SCHED_REQUIRED > 0 #include #endif -#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.18:2018:10:16" +#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.18:2018:10:31" #define NEURONSPI_MAX_DEVS 3 #define NEURONSPI_MAX_UART 16 @@ -64,7 +64,7 @@ #define NEURONSPI_DEFAULT_FREQ 600000 #define NEURONSPI_COMMON_FREQ 12000000 #define NEURONSPI_SLOWER_FREQ 7500000 -#define NEURONSPI_MAX_TX 62 +#define NEURONSPI_MAX_TX 60 //#define NEURONSPI_MAX_TX 256 #define NEURONSPI_MAX_BAUD 115200 #define NEURONSPI_FIFO_SIZE 256 diff --git a/modules/unipi/src/unipi_spi.c b/modules/unipi/src/unipi_spi.c index 54abaa7..3aacf9b 100644 --- a/modules/unipi/src/unipi_spi.c +++ b/modules/unipi/src/unipi_spi.c @@ -570,7 +570,7 @@ void neuronspi_spi_uart_read(struct spi_device* spi, u8 *recv_buf, s32 len, u8 u send_op.first_message[2] = 0; send_op.first_message[3] = uart_index; - send_buf = kzalloc(transmit_len, GFP_ATOMIC); + send_buf = kzalloc(transmit_len+64/*safety space*/, GFP_ATOMIC); #if 1 send_op.first_message[0] = 0x65; @@ -1053,7 +1053,7 @@ struct file_operations file_ops = int char_register_driver(void) { int major; - + struct device *parent = NULL; if (neuronspi_cdrv.major_number >= 0) return 0; // Character device registration @@ -1078,8 +1078,9 @@ int char_register_driver(void) // Device driver registration /*neuronspi_cdrv.dev = device_create_with_groups(neuronspi_cdrv.driver_class, &(neuron_plc_dev->dev), \ MKDEV(major, 0), NULL, neuron_plc_attr_groups, NEURON_DEVICE_NAME);*/ - - neuronspi_cdrv.dev = device_create(neuronspi_cdrv.driver_class, &(neuron_plc_dev->dev), MKDEV(major, 0), \ + + if (neuron_plc_dev != NULL) parent = &(neuron_plc_dev->dev); + neuronspi_cdrv.dev = device_create(neuronspi_cdrv.driver_class, parent, MKDEV(major, 0), \ neuron_plc_dev, NEURON_DEVICE_NAME); if (IS_ERR(neuronspi_cdrv.dev)) { class_destroy(neuronspi_cdrv.driver_class);