Bug in mtd_blkdevs-24.c for devfs

Andy Hawkins a.hawkins at cabletime.com
Thu Jun 17 10:41:51 EDT 2004


Hi,

I guess people don't generally use a large number of flash devices, but
if there are more than 10, then the devfs entries will be wrong because
of the following lines in add_mtd_blktrans_dev:

                char name[2];

                name[0] = '0' + new->devnum;
                name[1] = 0;

		new->blkcore_priv = 
			devfs_register(tr->blkcore_priv->devfs_dir_handle,
				       name, DEVFS_FL_DEFAULT, 				       tr->major,
				       new->devnum,         				       S_IFBLK|S_IRUGO|S_IWUGO,
				       &mtd_blktrans_ops, NULL);

For any devnum > 9, this will generate a punctuation character. The
following code is more correct (and is the same as in mtdchar.c)

		char name[10];

		sprintf(name,"%d",new->devnum);

		new->blkcore_priv = 
			devfs_register(tr->blkcore_priv->devfs_dir_handle,
				       name, DEVFS_FL_DEFAULT, 				       tr->major,
				       new->devnum,         				       S_IFBLK|S_IRUGO|S_IWUGO,
				       &mtd_blktrans_ops, NULL);

Apologies for the formatting, I can generate a patch if required...

Andy






More information about the linux-mtd mailing list