---
title: withSubRange
framework: kernel
role: pseudoSymbol
path: kernel/iodevicememory/1811112-withsubrange
---

# withSubRange

Constructs an IODeviceMemory instance, describing a subset of an existing IODeviceMemory range.

## Declaration

```occ
static IODeviceMemory * withSubRange( 
 IODeviceMemory *of, 
 IOPhysicalAddressoffset, 
 IOPhysicalLengthlength ); 
```

## Parameters

- `of`: The parent IODeviceMemory of which a subrange is to be used for the new descriptor, which will be retained by the subrange IODeviceMemory.
- `offset`: A byte offset into the parent's memory.
- `length`: The length of the subrange.

## Return Value

Return Value Returns the created IODeviceMemory on success, to be released by the caller, or zero on failure.

## Overview

Overview This method creates an IODeviceMemory instance for a subset of an existing IODeviceMemory range, passed as a physical address offset and length. It just calls IOMemoryDescriptor::withSubRange.

## See Also

### Miscellaneous

- [arrayFromList](kernel/iodevicememory/1811066-arrayfromlist.md)
- [withRange](kernel/iodevicememory/1811085-withrange.md)
