[#4407] bogus str_ident check in arch/blackfin/kernel/bfin_gpio.c

Document created by Aaronwu Employee on Aug 29, 2013
Version 1Show Document
  • View in full screen mode

[#4407] bogus str_ident check in arch/blackfin/kernel/bfin_gpio.c

Submitted By: Mike Frysinger

Open Date

2008-09-04 02:28:30     Close Date

2008-11-14 06:20:58

Priority:

Medium     Assignee:

Michael Hennerich

Status:

Closed     Fixed In Release:

N/A

Found In Release:

N/A     Release:

Category:

N/A     Board:

N/A

Processor:

N/A     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

Fixed

Uboot version or rev.:

    Toolchain version or rev.:

App binary format:

N/A     

Summary: bogus str_ident check in arch/blackfin/kernel/bfin_gpio.c

Details:

 

str_ident is declared like so:

static struct str_ident {

    char name[RESOURCE_LABEL_SIZE];

} str_ident[MAX_RESOURCES];

 

and then later in the code, it is checked like so:

static void set_label(unsigned short ident, const char *label)

{

    if (label && str_ident) {

 

static char *get_label(unsigned short ident)

{

    if (!str_ident)

 

static int cmp_label(unsigned short ident, const char *label)

{

    if (label && str_ident)

 

because of how it is declared, these pointer checks will always evaluate to true.  it is impossible for it to be NULL.

 

Path: kernel/bfin_gpio.c

Name: bfin_gpio.c

URL: svn://depot/svn/linux-kernel/trunk/arch/blackfin/kernel/bfin_gpio.c

Repository Root: svn://depot/svn/linux-kernel

Repository UUID: 526b6c2d-f592-4532-a319-5dd88ccb003d

Revision: 5230

Node Kind: file

Schedule: normal

Last Changed Author: hennerich

Last Changed Rev: 4963

Last Changed Date: 2008-07-15 08:13:31 -0400 (Tue, 15 Jul 2008)

Text Last Updated: 2008-08-09 02:47:56 -0400 (Sat, 09 Aug 2008)

Checksum: b74feefe498c1bca7ea0511cf38ccedc

 

Follow-ups

 

--- Michael Hennerich                                        2008-10-10 10:30:31

Yeah – str_ident pointer check was a leftover.

Originally I dynamically malloced  str_ident.

This caused troubles since GPIOs are used before the memory system is fully

setup.

 

Fixed on trunk.

 

-Michael

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes