Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
12a7558c
Commit
12a7558c
authored
Feb 18, 2003
by
Andrew Morton
Committed by
Linus Torvalds
Feb 18, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] lib/idr.c 64-bit fixes
Various overflow problems compiling the lib/idr.c code for ppc64
parent
a1861dbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
include/linux/idr.h
include/linux/idr.h
+2
-2
lib/idr.c
lib/idr.c
+4
-4
No files found.
include/linux/idr.h
View file @
12a7558c
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
/* Leave the possibility of an incomplete final layer */
/* Leave the possibility of an incomplete final layer */
#define MAX_LEVEL (BITS_PER_LONG - RESERVED_ID_BITS + IDR_BITS - 1) / IDR_BITS
#define MAX_LEVEL (BITS_PER_LONG - RESERVED_ID_BITS + IDR_BITS - 1) / IDR_BITS
#define MAX_ID_SHIFT (BITS_PER_LONG - RESERVED_ID_BITS)
#define MAX_ID_SHIFT (BITS_PER_LONG - RESERVED_ID_BITS)
#define MAX_ID_BIT (1 << MAX_ID_SHIFT)
#define MAX_ID_BIT (1
L
<< MAX_ID_SHIFT)
#define MAX_ID_MASK (MAX_ID_BIT - 1)
#define MAX_ID_MASK (MAX_ID_BIT - 1)
/* Number of id_layer structs to leave in free list */
/* Number of id_layer structs to leave in free list */
...
@@ -43,7 +43,7 @@ struct idr_layer {
...
@@ -43,7 +43,7 @@ struct idr_layer {
struct
idr
{
struct
idr
{
struct
idr_layer
*
top
;
struct
idr_layer
*
top
;
int
layers
;
int
layers
;
int
count
;
long
count
;
struct
idr_layer
*
id_free
;
struct
idr_layer
*
id_free
;
int
id_free_cnt
;
int
id_free_cnt
;
spinlock_t
lock
;
spinlock_t
lock
;
...
...
lib/idr.c
View file @
12a7558c
...
@@ -150,7 +150,7 @@ EXPORT_SYMBOL(idr_pre_get);
...
@@ -150,7 +150,7 @@ EXPORT_SYMBOL(idr_pre_get);
static
inline
int
sub_alloc
(
struct
idr
*
idp
,
int
shift
,
void
*
ptr
)
static
inline
int
sub_alloc
(
struct
idr
*
idp
,
int
shift
,
void
*
ptr
)
{
{
int
n
,
v
=
0
;
long
n
,
v
=
0
;
struct
idr_layer
*
p
;
struct
idr_layer
*
p
;
struct
idr_layer
**
pa
[
MAX_LEVEL
];
struct
idr_layer
**
pa
[
MAX_LEVEL
];
struct
idr_layer
***
paa
=
&
pa
[
0
];
struct
idr_layer
***
paa
=
&
pa
[
0
];
...
@@ -211,7 +211,7 @@ static inline int sub_alloc(struct idr *idp, int shift, void *ptr)
...
@@ -211,7 +211,7 @@ static inline int sub_alloc(struct idr *idp, int shift, void *ptr)
int
idr_get_new
(
struct
idr
*
idp
,
void
*
ptr
)
int
idr_get_new
(
struct
idr
*
idp
,
void
*
ptr
)
{
{
int
v
;
long
v
;
if
(
idp
->
id_free_cnt
<
idp
->
layers
+
1
)
if
(
idp
->
id_free_cnt
<
idp
->
layers
+
1
)
return
(
-
1
);
return
(
-
1
);
...
@@ -236,7 +236,7 @@ int idr_get_new(struct idr *idp, void *ptr)
...
@@ -236,7 +236,7 @@ int idr_get_new(struct idr *idp, void *ptr)
idp
->
count
++
;
idp
->
count
++
;
v
+=
(
idp
->
count
<<
MAX_ID_SHIFT
);
v
+=
(
idp
->
count
<<
MAX_ID_SHIFT
);
if
(
unlikely
(
v
==
-
1
))
if
(
unlikely
(
v
==
-
1
))
v
+=
(
1
<<
MAX_ID_SHIFT
);
v
+=
(
1
L
<<
MAX_ID_SHIFT
);
}
}
return
(
v
);
return
(
v
);
}
}
...
@@ -259,7 +259,7 @@ static inline void sub_remove(struct idr *idp, int shift, int id)
...
@@ -259,7 +259,7 @@ static inline void sub_remove(struct idr *idp, int shift, int id)
p
=
p
->
ary
[
n
];
p
=
p
->
ary
[
n
];
shift
-=
IDR_BITS
;
shift
-=
IDR_BITS
;
}
}
if
(
likely
(
p
)){
if
(
likely
(
p
!=
NULL
)){
int
n
=
id
&
IDR_MASK
;
int
n
=
id
&
IDR_MASK
;
__clear_bit
(
n
,
&
p
->
bitmap
);
__clear_bit
(
n
,
&
p
->
bitmap
);
p
->
ary
[
n
]
=
NULL
;
p
->
ary
[
n
]
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment