@@ -214,8 +214,8 @@ pub fn keyctl_setperm(id: KeyringSerial, perm: KeyPermissions) -> Result<()> {
214
214
}
215
215
216
216
pub fn keyctl_describe ( id : KeyringSerial , mut buffer : Option < Out < [ u8 ] > > ) -> Result < usize > {
217
+ let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
217
218
unsafe {
218
- let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
219
219
keyctl ! (
220
220
libc:: KEYCTL_DESCRIBE ,
221
221
id. get( ) ,
@@ -259,8 +259,8 @@ pub fn keyctl_search(
259
259
}
260
260
261
261
pub fn keyctl_read ( id : KeyringSerial , mut buffer : Option < Out < [ u8 ] > > ) -> Result < usize > {
262
+ let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
262
263
unsafe {
263
- let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
264
264
keyctl ! (
265
265
libc:: KEYCTL_READ ,
266
266
id. get( ) ,
@@ -317,8 +317,8 @@ pub fn keyctl_assume_authority(key: Option<KeyringSerial>) -> Result<()> {
317
317
}
318
318
319
319
pub fn keyctl_get_security ( key : KeyringSerial , mut buffer : Option < Out < [ u8 ] > > ) -> Result < usize > {
320
+ let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
320
321
unsafe {
321
- let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
322
322
keyctl ! (
323
323
libc:: KEYCTL_GET_SECURITY ,
324
324
key. get( ) ,
@@ -365,8 +365,8 @@ pub fn keyctl_dh_compute(
365
365
base : KeyringSerial ,
366
366
mut buffer : Option < Out < [ u8 ] > > ,
367
367
) -> Result < usize > {
368
+ let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
368
369
unsafe {
369
- let capacity = buffer. as_mut ( ) . map_or ( 0 , |b| b. len ( ) ) ;
370
370
keyctl ! (
371
371
libc:: KEYCTL_DH_COMPUTE ,
372
372
private. get( ) ,
0 commit comments