xf86drm: use max size of drm node name instead of arbitrary size
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>main
parent
0d5ea07736
commit
6869e4cea7
|
@ -317,7 +317,7 @@ static int drmOpenDevice(dev_t dev, int minor, int type)
|
|||
{
|
||||
stat_t st;
|
||||
const char *dev_name;
|
||||
char buf[64];
|
||||
char buf[DRM_NODE_NAME_MAX];
|
||||
int fd;
|
||||
mode_t devmode = DRM_DEV_MODE, serv_mode;
|
||||
gid_t serv_group;
|
||||
|
@ -445,7 +445,7 @@ wait_for_udev:
|
|||
static int drmOpenMinor(int minor, int create, int type)
|
||||
{
|
||||
int fd;
|
||||
char buf[64];
|
||||
char buf[DRM_NODE_NAME_MAX];
|
||||
const char *dev_name;
|
||||
|
||||
if (create)
|
||||
|
|
|
@ -93,6 +93,14 @@ extern "C" {
|
|||
#define DRM_CONTROL_DEV_NAME "%s/" DRM_CONTROL_MINOR_NAME "%d"
|
||||
#define DRM_RENDER_DEV_NAME "%s/" DRM_RENDER_MINOR_NAME "%d"
|
||||
|
||||
#define DRM_NODE_NAME_MAX \
|
||||
(sizeof(DRM_DIR_NAME) + 1 /* slash */ \
|
||||
+ MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), \
|
||||
sizeof(DRM_CONTROL_MINOR_NAME), \
|
||||
sizeof(DRM_RENDER_MINOR_NAME)) \
|
||||
+ sizeof("144") /* highest possible node number */ \
|
||||
+ 1) /* NULL-terminator */
|
||||
|
||||
#define DRM_ERR_NO_DEVICE (-1001)
|
||||
#define DRM_ERR_NO_ACCESS (-1002)
|
||||
#define DRM_ERR_NOT_ROOT (-1003)
|
||||
|
|
Loading…
Reference in New Issue