Showing error 1822

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/mtd/devices/m25p80.c
Line in file: 418
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

388        spi_message_add_tail(&t[0], &m);
389
390        t[1].tx_buf = buf;
391        spi_message_add_tail(&t[1], &m);
392
393        mutex_lock(&flash->lock);
394
395        /* Wait until finished previous write command. */
396        if (wait_till_ready(flash)) {
397                mutex_unlock(&flash->lock);
398                return 1;
399        }
400
401        write_enable(flash);
402
403        /* Set up the opcode in the write buffer. */
404        flash->command[0] = OPCODE_PP;
405        flash->command[1] = to >> 16;
406        flash->command[2] = to >> 8;
407        flash->command[3] = to;
408
409        /* what page do we start with? */
410        page_offset = to % FLASH_PAGESIZE;
411
412        /* do all the bytes fit onto one page? */
413        if (page_offset + len <= FLASH_PAGESIZE) {
414                t[1].len = len;
415
416                spi_sync(flash->spi, &m);
417
418                *retlen = m.actual_length - CMD_SIZE;
419        } else {
420                u32 i;
421
422                /* the size of data remaining on the first page */
423                page_size = FLASH_PAGESIZE - page_offset;
424
425                t[1].len = page_size;
426                spi_sync(flash->spi, &m);
427
428                *retlen = m.actual_length - CMD_SIZE;
Show full sources