Patchwork [2/4] makedevs: Correct the device number calculation for blocks of devices

login
register
mail settings
Submitter Peter Kjellerstedt
Date May 29, 2013, 2:55 p.m.
Message ID <e95c7006a8e02ae0394f0057877407a486641046.1369839249.git.pkj@axis.com>
Download mbox | patch
Permalink /patch/50701/
State Accepted
Commit 0a878426bee607a7d961ba475a7ec7e89115df35
Headers show

Comments

Peter Kjellerstedt - May 29, 2013, 2:55 p.m.
If the increment > 1 and the start > 0 then the calculation for the
minor device number was incorrect.
---
 meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
index 247d6c1..d58e891 100644
--- a/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
+++ b/meta/recipes-devtools/makedevs/makedevs-1.0.0/makedevs.c
@@ -226,7 +226,7 @@  static int interpret_table_entry(char *line)
 				sprintf(path, "%s/%s%d", rootdir, name, i);
 				/* FIXME:  MKDEV uses illicit insider knowledge of kernel 
 				 * major/minor representation...  */
-				rdev = MKDEV(major, minor + (i * increment - start));
+				rdev = MKDEV(major, minor + (i - start) * increment);
 				add_new_device(buf, path, uid, gid, mode, rdev);
 			}
 		} else {